diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-08-17 22:42:12 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-08-17 22:42:12 +0530 |
commit | ccef1f9a0035a5b8e3494bcc22c09ad3acc49097 (patch) | |
tree | a20228902afdd0af64683f38fcf270bbc3fa1670 /mal | |
parent | adffba663dbe8daebe311dc8f3ae5d40109cb2dd (diff) |
reading auth token from config file (if any)
Diffstat (limited to 'mal')
-rw-r--r-- | mal/mal.go | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -61,6 +61,7 @@ func Init() { confSearchLength := viper.Get("searching.search_length") confSearchOffset := viper.Get("searching.search_offset") confSearchNsfw := viper.Get("searching.search_nsfw") + confSecret := viper.Get("auth.token") // if SearchLength is the default value just use the one in config file if any if confSearchLength != nil && SearchLength == 10 { @@ -75,6 +76,12 @@ func Init() { SearchNSFW = confSearchNsfw.(bool) } + /* the secret stored in the config file + * takes precedence on the system keyring */ + if confSecret != nil && confSecret != "" { + Secret = confSecret.(string) + } + // initialise MAL2Go Client(s) animeClient.AuthToken = tk mangaClient.AuthToken = tk |