Skip to content

Commit 4d8cd99

Browse files
authored
Update config.go
1 parent 045b949 commit 4d8cd99

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

internals/config/config.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@ var ENV = &structure.ENV{
1616
func Load() {
1717
ENV.LOG_LEVEL = os.Getenv("LOG_LEVEL")
1818

19-
discoveryInterval, err := strconv.Atoi(os.Getenv("DISCOVERY_INTERVAL"))
19+
discoveryIntervalStr := os.Getenv("DISCOVERY_INTERVAL")
2020

21-
if err != nil {
22-
if discoveryInterval > 0 {
21+
if discoveryIntervalStr != "" {
22+
discoveryInterval, err := strconv.Itoa(discoveryIntervalStr)
23+
if err != nil {
2324
ENV.DISCOVERY_INTERVAL = discoveryInterval
2425
}
2526
}
2627

27-
aliveInterval, err := strconv.Atoi(os.Getenv("ALIVE_INTERVAL"))
28+
aliveIntervalStr := os.Getenv("ALIVE_INTERVAL")
2829

29-
if err != nil {
30-
if aliveInterval > 0 {
30+
if aliveIntervalStr != "" {
31+
aliveInterval, err := strconv.Itoa(aliveIntervalStr)
32+
if err != nil {
3133
ENV.ALIVE_INTERVAL = aliveInterval
3234
}
3335
}
@@ -39,4 +41,4 @@ func Load() {
3941

4042
func Log() {
4143
logger.Dev("Loaded Environment:", ENV)
42-
}
44+
}

0 commit comments

Comments
 (0)