Skip to content

Commit 667bbe2

Browse files
committed
use urls from zos-config if exists
1 parent ab3b8fa commit 667bbe2

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

pkg/environment/config.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@ type Config struct {
3030
RolloutUpgrade struct {
3131
TestFarms []uint32 `json:"test_farms"`
3232
} `json:"rollout_upgrade"`
33-
RelaysURLs []string `json:"relays_urls"`
33+
RelaysURLs []string `json:"relays_urls"`
34+
SubstrateURL []string `json:"substrate_urls"`
35+
ActivationURL []string `json:"activation_urls"`
36+
GraphQL []string `json:"graphql_urls"`
37+
KycURL string `json:"kyc_url"`
38+
RegistrarURL string `json:"registrar_url"`
39+
FlistURL string `json:"flist_url"`
40+
BinRepo string `json:"bin_repo"`
3441
}
3542

3643
// Merge, updates current config with cfg merging and override config

pkg/environment/environment.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ func getEnvironmentFromParams(params kernel.Params) (Environment, error) {
269269
if len(runmode) == 0 {
270270
runmode = string(RunningMain)
271271
}
272+
config, err := GetConfig()
273+
if err != nil {
274+
return env, err
275+
}
272276

273277
switch RunMode(runmode) {
274278
case RunningDev:
@@ -287,18 +291,44 @@ func getEnvironmentFromParams(params kernel.Params) (Environment, error) {
287291
if len(substrate) > 0 {
288292
env.SubstrateURL = substrate
289293
}
294+
} else if substrate := config.SubstrateURL; len(substrate) > 0 {
295+
env.SubstrateURL = substrate
290296
}
291297

292298
if relay, ok := params.Get("relay"); ok {
293299
if len(relay) > 0 {
294300
env.relaysURLs = relay
295301
}
302+
} else if relay := config.RelaysURLs; len(relay) > 0 {
303+
env.relaysURLs = relay
296304
}
297305

298306
if activation, ok := params.Get("activation"); ok {
299307
if len(activation) > 0 {
300308
env.ActivationURL = activation
301309
}
310+
} else if activation := config.ActivationURL; len(activation) > 0 {
311+
env.ActivationURL = activation
312+
}
313+
314+
if graphql := config.GraphQL; len(graphql) > 0 {
315+
env.GraphQL = graphql
316+
}
317+
318+
if flist := config.FlistURL; len(flist) > 0 {
319+
env.FlistURL = flist
320+
}
321+
322+
if bin := config.FlistURL; len(bin) > 0 {
323+
env.FlistURL = bin
324+
}
325+
326+
if kyc := config.FlistURL; len(kyc) > 0 {
327+
env.FlistURL = kyc
328+
}
329+
330+
if registrar := config.FlistURL; len(registrar) > 0 {
331+
env.FlistURL = registrar
302332
}
303333

304334
if farmSecret, ok := params.Get("secret"); ok {

0 commit comments

Comments
 (0)