Skip to content

Commit af9ae85

Browse files
committed
The NotLoadCacheAtStart parameter is added to nacos
1 parent b225867 commit af9ae85

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

zrpc/registry/nacos/builder.go

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ func (b *builder) Build(url resolver.Target, conn resolver.ClientConn, opts reso
4646
Username: tgt.User,
4747
Password: tgt.Password,
4848
TimeoutMs: uint64(tgt.Timeout),
49+
NotLoadCacheAtStart: tgt.NotLoadCacheAtStart,
50+
UpdateCacheWhenEmpty: tgt.UpdateCacheWhenEmpty,
4951
}
5052

5153
if tgt.CacheDir != "" {

zrpc/registry/nacos/target.go

+18
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ type target struct {
2323
LogLevel string `key:",optional"`
2424
LogDir string `key:",optional"`
2525
CacheDir string `key:",optional"`
26+
NotLoadCacheAtStart bool `key:"notLoadCacheAtStart,optional"`
27+
UpdateCacheWhenEmpty bool `key:"updateCacheWhenEmpty,optional"`
2628
}
2729

2830
// parseURL with parameters
@@ -57,5 +59,21 @@ func parseURL(rawURL url.URL) (target, error) {
5759
tgt.Addr = rawURL.Host
5860
tgt.Service = strings.TrimLeft(rawURL.Path, "/")
5961

62+
if logLevel, exists := os.LookupEnv("NACOS_LOG_LEVEL"); exists {
63+
tgt.LogLevel = logLevel
64+
}
65+
66+
if logDir, exists := os.LookupEnv("NACOS_LOG_DIR"); exists {
67+
tgt.LogDir = logDir
68+
}
69+
70+
if notLoadCacheAtStart, exists := os.LookupEnv("NACOS_NOT_LOAD_CACHE_AT_START"); exists {
71+
tgt.NotLoadCacheAtStart = notLoadCacheAtStart == "true"
72+
}
73+
74+
if updateCacheWhenEmpty, exists := os.LookupEnv("NACOS_UPDATE_CACHE_WHEN_EMPTY"); exists {
75+
tgt.UpdateCacheWhenEmpty = updateCacheWhenEmpty == "true"
76+
}
77+
6078
return tgt, nil
6179
}

0 commit comments

Comments
 (0)