Skip to content

Commit 5655d0d

Browse files
committed
rename default urls
1 parent 82870df commit 5655d0d

File tree

2 files changed

+39
-39
lines changed

2 files changed

+39
-39
lines changed

pkg/environment/config.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,17 @@ type Config struct {
3636
GraphQL []string `json:"graphql_urls"`
3737
KycURL string `json:"kyc_url"`
3838
RegistrarURL string `json:"registrar_url"`
39-
FlistURL string `json:"flist_url"`
40-
V4FlistURL string `json:"v4_flist_url"`
41-
HubURL string `json:"hub_url"`
42-
V4HubURL string `json:"v4_hub_url"`
43-
HubStorage string `json:"hub_storage"`
44-
V4HubStorage string `json:"v4_hub_storage"`
4539
BinRepo string `json:"bin_repo"`
4640
GeoipURLs []string `json:"geoip_urls"`
41+
42+
FlistURL string `json:"flist_url"`
43+
V4FlistURL string `json:"v4_flist_url"`
44+
45+
HubURL string `json:"hub_url"`
46+
V4HubURL string `json:"v4_hub_url"`
47+
48+
HubStorage string `json:"hub_storage"`
49+
V4HubStorage string `json:"v4_hub_storage"`
4750
}
4851

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

pkg/environment/environment.go

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ import (
1818
const (
1919
baseExtendedURL = "https://raw.githubusercontent.com/threefoldtech/zos-config/main/"
2020

21-
hubURL = "https://hub.threefold.me"
22-
v4HubURL = "https://v4.hub.threefold.me"
21+
defaultHubURL = "https://hub.threefold.me"
22+
defaultV4HubURL = "https://v4.hub.threefold.me"
2323

24-
flistURL = "redis://hub.threefold.me:9900"
25-
v4FlistURL = "redis://v4.hub.threefold.me:9940"
24+
defaultFlistURL = "redis://hub.threefold.me:9900"
25+
defaultV4FlistURL = "redis://v4.hub.threefold.me:9940"
2626

2727
defaultHubStorage = "zdb://hub.threefold.me:9900"
2828
defaultV4HubStorage = "zdb://v4.hub.threefold.me:9940"
@@ -55,11 +55,12 @@ type Environment struct {
5555
RunningMode RunMode
5656

5757
FlistURL string
58-
HubURL string
59-
V4HubURL string
6058
HubStorage string
6159
BinRepo string
6260

61+
HubURL string
62+
V4HubURL string
63+
6364
FarmID pkg.FarmID
6465
Orphan bool
6566

@@ -127,6 +128,7 @@ const (
127128
var (
128129
pool substrate.Manager
129130
poolOnce sync.Once
131+
confOnce sync.Once
130132

131133
envDev = Environment{
132134
RunningMode: RunningDev,
@@ -142,9 +144,9 @@ var (
142144
"https://activation.dev.grid.tf/activation/activate",
143145
"https://activation.02.dev.grid.tf/activation/activate",
144146
},
145-
FlistURL: flistURL,
146-
HubURL: hubURL,
147-
V4HubURL: v4HubURL,
147+
FlistURL: defaultFlistURL,
148+
HubURL: defaultHubURL,
149+
V4HubURL: defaultV4HubURL,
148150
HubStorage: defaultHubStorage,
149151
BinRepo: "tf-zos-v3-bins.dev",
150152
GraphQL: []string{
@@ -170,9 +172,9 @@ var (
170172
"https://activation.test.grid.tf/activation/activate",
171173
"https://activation.02.test.grid.tf/activation/activate",
172174
},
173-
FlistURL: flistURL,
174-
HubURL: hubURL,
175-
V4HubURL: v4HubURL,
175+
FlistURL: defaultFlistURL,
176+
HubURL: defaultHubURL,
177+
V4HubURL: defaultV4HubURL,
176178
HubStorage: defaultHubStorage,
177179
BinRepo: "tf-zos-v3-bins.test",
178180
GraphQL: []string{
@@ -198,9 +200,9 @@ var (
198200
"https://activation.qa.grid.tf/activation/activate",
199201
"https://activation.02.qa.grid.tf/activation/activate",
200202
},
201-
FlistURL: flistURL,
202-
HubURL: hubURL,
203-
V4HubURL: v4HubURL,
203+
FlistURL: defaultFlistURL,
204+
HubURL: defaultHubURL,
205+
V4HubURL: defaultV4HubURL,
204206
HubStorage: defaultHubStorage,
205207
BinRepo: "tf-zos-v3-bins.qanet",
206208
GraphQL: []string{
@@ -226,19 +228,19 @@ var (
226228
// "wss://relay.02.grid.tf",
227229
},
228230
ActivationURL: []string{
229-
"https://activation.grid.threefold.me/activation/activate",
230231
"https://activation.grid.tf/activation/activate",
231232
"https://activation.02.grid.tf/activation/activate",
233+
"https://activation.grid.threefold.me/activation/activate",
232234
},
233-
FlistURL: flistURL,
234-
HubURL: hubURL,
235-
V4HubURL: v4HubURL,
235+
FlistURL: defaultFlistURL,
236+
HubURL: defaultHubURL,
237+
V4HubURL: defaultV4HubURL,
236238
HubStorage: defaultHubStorage,
237239
BinRepo: "tf-zos-v3-bins",
238240
GraphQL: []string{
239-
"https://graphql.grid.threefold.me/graphql",
240241
"https://graphql.grid.tf/graphql",
241242
"https://graphql.02.grid.tf/graphql",
243+
"https://graphql.grid.threefold.me/graphql",
242244
},
243245
KycURL: "https://kyc.threefold.me",
244246
RegistrarURL: "https://registrar.prod4.threefold.me",
@@ -326,29 +328,24 @@ func getEnvironmentFromParams(params kernel.Params) (Environment, error) {
326328
if err != nil {
327329
// maybe the node can't reach the internet right now
328330
// this will enforce node to skip config
331+
// or we can keep retrying untill it can fetch config
329332
config = Config{}
330333
}
331334

332-
if substrate, ok := params.Get("substrate"); ok {
333-
if len(substrate) > 0 {
334-
env.SubstrateURL = substrate
335-
}
335+
if substrate, ok := params.Get("substrate"); ok && len(substrate) > 0 {
336+
env.SubstrateURL = substrate
336337
} else if substrate := config.SubstrateURL; len(substrate) > 0 {
337338
env.SubstrateURL = substrate
338339
}
339340

340-
if relay, ok := params.Get("relay"); ok {
341-
if len(relay) > 0 {
342-
env.relaysURLs = relay
343-
}
341+
if relay, ok := params.Get("relay"); ok && len(relay) > 0 {
342+
env.relaysURLs = relay
344343
} else if relay := config.RelaysURLs; len(relay) > 0 {
345344
env.relaysURLs = relay
346345
}
347346

348-
if activation, ok := params.Get("activation"); ok {
349-
if len(activation) > 0 {
350-
env.ActivationURL = activation
351-
}
347+
if activation, ok := params.Get("activation"); ok && len(activation) > 0 {
348+
env.ActivationURL = activation
352349
} else if activation := config.ActivationURL; len(activation) > 0 {
353350
env.ActivationURL = activation
354351
}
@@ -392,7 +389,7 @@ func getEnvironmentFromParams(params kernel.Params) (Environment, error) {
392389

393390
// if the node running v4 chage urls to use v4 hub
394391
if params.IsV4() {
395-
env.FlistURL = v4FlistURL
392+
env.FlistURL = defaultV4FlistURL
396393
if flist := config.V4FlistURL; len(flist) > 0 {
397394
env.FlistURL = flist
398395
}

0 commit comments

Comments
 (0)