diff options
author | William Carroll <wpcarro@gmail.com> | 2020-02-23T20·00+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-02-23T20·01+0000 |
commit | a1a4689ad330796a85350e850b32c20aae0c82fd (patch) | |
tree | 346a8750dc6805939da268d8d59a839a8d26fc3e /monzo_ynab/tokens.go | |
parent | b5d4f547d241b16ac068cb571ddadef0752e63c3 (diff) |
Consume updated kv module
Exposing store_path to the tokens module to support the newly updated kv module, which requires an explicit storePath parameter.
Diffstat (limited to 'monzo_ynab/tokens.go')
-rw-r--r-- | monzo_ynab/tokens.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/monzo_ynab/tokens.go b/monzo_ynab/tokens.go index 7afd86e4cf72..4be967ccb803 100644 --- a/monzo_ynab/tokens.go +++ b/monzo_ynab/tokens.go @@ -76,6 +76,7 @@ var chans = &channels{ var ( monzoClientId = os.Getenv("monzo_client_id") monzoClientSecret = os.Getenv("monzo_client_secret") + storePath = os.Getenv("store_path") ) //////////////////////////////////////////////////////////////////////////////// @@ -151,8 +152,8 @@ func refreshTokens(refreshToken string) (string, string) { func persistTokens(access string, refresh string) { log.Println("Persisting tokens...") - kv.Set("monzoAccessToken", access) - kv.Set("monzoRefreshToken", refresh) + kv.Set(storePath, "monzoAccessToken", access) + kv.Set(storePath, "monzoRefreshToken", refresh) log.Println("Successfully persisted tokens.") } @@ -221,8 +222,8 @@ func main() { }() // Retrieve cached tokens from store. - accessToken := fmt.Sprintf("%v", kv.Get("monzoAccessToken")) - refreshToken := fmt.Sprintf("%v", kv.Get("monzoRefreshToken")) + accessToken := fmt.Sprintf("%v", kv.Get(storePath, "monzoAccessToken")) + refreshToken := fmt.Sprintf("%v", kv.Get(storePath, "monzoRefreshToken")) log.Println("Attempting to retrieve cached credentials...") logTokens(accessToken, refreshToken) |