Skip to content

Commit

Permalink
Continuously refresh CM
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibling committed Feb 4, 2024
1 parent 736f9df commit 32ac58d
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,25 +368,25 @@ func main() {
}
time.Sleep(time.Duration(10) * time.Second)

fileInfo, err := os.Stat("credentials.json")
// fileInfo, err := os.Stat("credentials.json")
// if err != nil {
// TERMINATED = err.Error()
// }

// if LASTMOD < fileInfo.ModTime().Unix() {
updatedCredentials := &map[string]Credential{}
credentialFile, err := os.ReadFile("credentials.json")
if err != nil {
TERMINATED = err.Error()
}

if LASTMOD < fileInfo.ModTime().Unix() {
updatedCredentials := &map[string]Credential{}
credentialFile, err := os.ReadFile("credentials.json")
if err != nil {
TERMINATED = err.Error()
}

json.Unmarshal(credentialFile, &updatedCredentials)
json.Unmarshal(credentialFile, &updatedCredentials)

config.Credentials = *updatedCredentials
LASTMOD = fileInfo.ModTime().Unix()
config.Credentials = *updatedCredentials
// LASTMOD = fileInfo.ModTime().Unix()

fmt.Println("Updated credentials")
fmt.Println(maps.Keys(*credentials))
}
fmt.Println("Updated credentials")
fmt.Println(maps.Keys(*credentials))
// }
}
}

0 comments on commit 32ac58d

Please sign in to comment.