From c2a738815adbf1c11f307f496298fb75dc2a0cee Mon Sep 17 00:00:00 2001
From: Kevin Lyda <kevin@ie.suberic.net>
Date: Mon, 23 Jan 2017 14:38:49 +0000
Subject: [PATCH] Read config.

---
 .gitignore       | 2 +-
 cmd/pjls/pjls.go | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 59a8594..5dacf12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
 /pjls
-/config
+/config.json
diff --git a/cmd/pjls/pjls.go b/cmd/pjls/pjls.go
index 42fef67..f594c53 100644
--- a/cmd/pjls/pjls.go
+++ b/cmd/pjls/pjls.go
@@ -16,8 +16,10 @@ func main() {
 
 	viper.SetConfigName("config")
 	viper.AddConfigPath(".")
+	viper.SetConfigType("json")
 	err := viper.ReadInConfig()
-	viper.Unmarshal(&c)
+	c.token = viper.Get("token")
+	c.baseurl = viper.Get("baseurl")
 
 	if err != nil {
 		panic(fmt.Errorf("Fatal error config file: %s \n", err))
-- 
GitLab