aboutsummaryrefslogtreecommitdiff
path: root/mal/mal.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-08-17 22:42:12 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-08-17 22:42:12 +0530
commitccef1f9a0035a5b8e3494bcc22c09ad3acc49097 (patch)
treea20228902afdd0af64683f38fcf270bbc3fa1670 /mal/mal.go
parentadffba663dbe8daebe311dc8f3ae5d40109cb2dd (diff)
reading auth token from config file (if any)
Diffstat (limited to 'mal/mal.go')
-rw-r--r--mal/mal.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/mal/mal.go b/mal/mal.go
index 670be07..04cce45 100644
--- a/mal/mal.go
+++ b/mal/mal.go
@@ -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