@@ -48,7 +48,14 @@ type WorkflowSettings struct {
4848}
4949
5050type WorkflowSettingsDomains struct {
51- Allowed []string `yaml:"allowed"`
51+ Allowed []string `yaml:"allowed"`
52+ Hosts []WorkflowSettingsDomainsHosts `yaml:"hosts"`
53+ }
54+
55+ type WorkflowSettingsDomainsHosts struct {
56+ Hostname string `yaml:"hostname"`
57+ Gateway * string `yaml:"gateway"`
58+ Headers []string `yaml:"headers"`
5259}
5360
5461type WorkflowSettingsCache struct {
@@ -180,6 +187,17 @@ func (workflow *StackupWorkflow) configureDefaultSettings() {
180187 workflow .Settings .Domains .Allowed = []string {"raw.githubusercontent.com" , "api.github.com" }
181188 }
182189
190+ if len (workflow .Settings .Domains .Hosts ) > 0 {
191+ for _ , host := range workflow .Settings .Domains .Hosts {
192+ if host .Gateway != nil && * host .Gateway == "allow" {
193+ workflow .Settings .Domains .Allowed = append (workflow .Settings .Domains .Allowed , host .Hostname )
194+ }
195+ if len (host .Headers ) > 0 {
196+ App .Gateway .SetDomainHeaders (host .Hostname , host .Headers )
197+ }
198+ }
199+ }
200+
183201 App .Gateway .SetAllowedDomains (workflow .Settings .Domains .Allowed )
184202
185203 if workflow .Settings .Cache .TtlMinutes <= 0 {
@@ -211,13 +229,18 @@ func (workflow *StackupWorkflow) createMissingSettingsSection() {
211229 if workflow .Settings == nil {
212230 verifyChecksums := true
213231 enableStats := false
232+ gatewayAllow := "allowed"
214233 workflow .Settings = & WorkflowSettings {
215234 AnonymousStatistics : & enableStats ,
216235 DotEnvFiles : []string {".env" },
217236 Cache : & WorkflowSettingsCache {TtlMinutes : 5 },
218237 ChecksumVerification : & verifyChecksums ,
219238 Domains : & WorkflowSettingsDomains {
220239 Allowed : []string {"raw.githubusercontent.com" , "api.github.com" },
240+ Hosts : []WorkflowSettingsDomainsHosts {
241+ {Hostname : "raw.githubusercontent.com" , Gateway : & gatewayAllow , Headers : nil },
242+ {Hostname : "api.github.com" , Gateway : & gatewayAllow , Headers : nil },
243+ },
221244 },
222245 Defaults : & WorkflowSettingsDefaults {
223246 Tasks : & WorkflowSettingsDefaultsTasks {
@@ -355,9 +378,9 @@ func (workflow *StackupWorkflow) handleDataNotCached(found bool, data *cache.Cac
355378
356379 if ! found || data .IsExpired () {
357380 if include .IsLocalFile () {
358- include .Contents , err = utils . GetFileContents (include .Filename ())
381+ include .Contents , err = App . Gateway . GetUrl (include .Filename ())
359382 } else if include .IsRemoteUrl () {
360- include .Contents , err = utils . GetUrlContentsEx (include .FullUrl (), include .Headers )
383+ include .Contents , err = App . Gateway . GetUrl (include .FullUrl (), include .Headers ... )
361384 } else if include .IsS3Url () {
362385 include .AccessKey = os .ExpandEnv (include .AccessKey )
363386 include .SecretKey = os .ExpandEnv (include .SecretKey )
0 commit comments