about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-13 03:52:15 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-13 03:52:15 -0400
commitf06a2d6126bed22d38b506e1edc8822386a7cc33 (patch)
tree282cb6924e3fa48fa457534f44efae0a256c697f
parentb42a3d0d66712b8da71e6f7984b3cf16d3e304fc (diff)
downloadgetwtxt-f06a2d6126bed22d38b506e1edc8822386a7cc33.tar.gz
fixed viper config parsing resulting in build errors
-rw-r--r--getwtxt.json2
-rw-r--r--init.go10
-rw-r--r--types.go9
3 files changed, 18 insertions, 3 deletions
diff --git a/getwtxt.json b/getwtxt.json
index c11c8e5..66c725e 100644
--- a/getwtxt.json
+++ b/getwtxt.json
@@ -6,6 +6,6 @@
     "name": "getwtxt",
     "url": "https://twtxt.example.com",
     "owner": "gbmor",
-    "ownermail": "ben@gbmor.dev"
+    "mail": "ben@gbmor.dev"
   }
 }
diff --git a/init.go b/init.go
index 2069ceb..f871a72 100644
--- a/init.go
+++ b/init.go
@@ -73,8 +73,11 @@ func initConfig() {
 
 	confObj.port = viper.GetInt("port")
 	confObj.logfile = viper.GetString("logfile")
-	confObj.twtxtfile = viper.GetString("twtxtfile")
 	confObj.stdoutLogging = viper.GetBool("stdoutLogging")
+	confObj.instance.name = viper.GetString("instance.name")
+	confObj.instance.url = viper.GetString("instance.url")
+	confObj.instance.owner = viper.GetString("instance.owner")
+	confObj.instance.mail = viper.GetString("instance.mail")
 }
 
 func initLogging() {
@@ -117,8 +120,11 @@ func rebindConfig() {
 	// reassign values to the config object
 	confObj.port = viper.GetInt("port")
 	confObj.logfile = viper.GetString("logfile")
-	confObj.twtxtfile = viper.GetString("twtxtfile")
 	confObj.stdoutLogging = viper.GetBool("stdoutLogging")
+	confObj.instance.name = viper.GetString("instance.name")
+	confObj.instance.url = viper.GetString("instance.url")
+	confObj.instance.owner = viper.GetString("instance.owner")
+	confObj.instance.mail = viper.GetString("instance.mail")
 
 	// reinitialize logging
 	initLogging()
diff --git a/types.go b/types.go
index e25e066..8e924ca 100644
--- a/types.go
+++ b/types.go
@@ -9,4 +9,13 @@ type configuration struct {
 	port          int
 	logfile       string
 	stdoutLogging bool
+	instance
 }
+type instance struct {
+	name  string
+	url   string
+	owner string
+	mail  string
+}
+
+// index of users