From ccef1f9a0035a5b8e3494bcc22c09ad3acc49097 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Wed, 17 Aug 2022 22:42:12 +0530 Subject: reading auth token from config file (if any) --- mal/mal.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mal') 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 -- cgit v1.2.3