diff options
Diffstat (limited to 'mal')
-rw-r--r-- | mal/mal.go | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -19,9 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. package mal import ( - _ "github.com/joho/godotenv/autoload" - "os" - + "github.com/MikunoNaka/macli/auth" a "github.com/MikunoNaka/MAL2Go/anime" m "github.com/MikunoNaka/MAL2Go/manga" ua "github.com/MikunoNaka/MAL2Go/user/anime" @@ -33,13 +31,12 @@ var mangaClient m.Client var userAnimeClient ua.Client var userMangaClient um.Client -func init() { - // TODO: don't load access token from .env - var accessToken = os.Getenv("ACCESS_TOKEN") +func Init() { + secret := auth.GetToken() // initialise MAL2Go Client(s) - animeClient.AuthToken = "Bearer " + accessToken - mangaClient.AuthToken = "Bearer " + accessToken - userAnimeClient.AuthToken = "Bearer " + accessToken - userMangaClient.AuthToken = "Bearer " + accessToken + animeClient.AuthToken = "Bearer " + secret + mangaClient.AuthToken = "Bearer " + secret + userAnimeClient.AuthToken = "Bearer " + secret + userMangaClient.AuthToken = "Bearer " + secret } |