summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-27 01:06:50 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-27 01:06:50 -0400
commitdaa48539f5ad8b444637f948b98996d35852b1e8 (patch)
tree60755e8b0a43b1e1d645a9221529324450974109
parent06b4e506f0666d3f717398aa7a48d2b0106214fe (diff)
downloadgetwtxt-daa48539f5ad8b444637f948b98996d35852b1e8.tar.gz
changed config format to yaml, commented config file
-rw-r--r--getwtxt.json15
-rw-r--r--getwtxt.yml71
-rw-r--r--init.go2
3 files changed, 72 insertions, 16 deletions
diff --git a/getwtxt.json b/getwtxt.json
deleted file mode 100644
index b739d8c..0000000
--- a/getwtxt.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "ListenPort": 9001,
-  "StdoutLogging": true,
-  "LogFile": "getwtxt.log",
-  "DatabasePath": "getwtxt.db",
-  "DatabasePushInterval": "5m",
-  "StatusFetchInterval": "1h",
-  "Instance": {
-    "SiteName": "getwtxt",
-    "URL": "https://twtxt.example.com",
-    "OwnerName": "foo barrington",
-    "Email": "foo@barrington.ext",
-    "Description": "This is the twtxt registry for the tildeverse network of public unix servers."
-  }
-}
diff --git a/getwtxt.yml b/getwtxt.yml
new file mode 100644
index 0000000..58b0af1
--- /dev/null
+++ b/getwtxt.yml
@@ -0,0 +1,71 @@
+#############################################################
+##  This config file can live in the following locations:  ##
+##                                                         ##
+##      ./                                                 ##
+##      /usr/local/getwtxt/                                ##
+##      /etc/                                              ##
+##      /usr/local/etc/                                    ##
+##                                                         ##
+##  The first location found wins. The file must be        ##
+##  called getwtxt.yml                                     ##
+##                                                         ##
+#############################################################
+
+#############################################################
+##  Changing the following options requires a restart.     ##
+#############################################################
+
+# This is the port that getwtxt will bind to.
+ListenPort: 9001
+
+# The location of the LevelDB database structure. Can be
+# a relative or absolute path.
+DatabasePath: "getwtxt.db"
+
+#############################################################
+##  The following options may be changed at any time.      ##
+##  getwtxt will automatically reload the config when      ##
+##  changes are detected.                                  ##
+#############################################################
+
+# If true, getwtxt will send all log messages, including
+# requests, to stdout. It will ignore any set log file.
+# Useful for debugging, but you probably want to keep
+# logs.
+StdoutLogging: true
+
+# The file getwtxt will append log messages to. Can be a
+# relative or absolute path.
+LogFile: "getwtxt.log"
+
+# This is the interval between data pushes from the 
+# in-memory cache to the on-disk database. 
+DatabasePushInterval: "5m"
+
+# The time getwtxt will wait between attempts to scrape
+# users' statuses from their twtxt.txt files
+StatusFetchInterval: "1h"
+
+# The following options pertain to your particular instance.
+# They are used in the default page shown when you visit
+# getwtxt in a web browser.
+Instance:
+
+  # The name of your instance.
+  SiteName: "getwtxt"
+
+  # Your instance's web address.
+  URL: "https://twtxt.example.com"
+
+  # Your name.
+  OwnerName: "foo barrington"
+  
+  # Your email address.
+  Email: "foo@barrington.ext"
+
+  # A short description of your instance, or your site.
+  # This is shown at the top of the default web page
+  # below your instance's name.
+  Description: "This is the twtxt registry for the tildeverse network of public unix servers."
+
+
diff --git a/init.go b/init.go
index 25beeed..6fd6bc8 100644
--- a/init.go
+++ b/init.go
@@ -81,7 +81,7 @@ func checkFlags() {
 func initConfig() {
 
 	viper.SetConfigName("getwtxt")
-	viper.SetConfigType("json")
+	viper.SetConfigType("yml")
 	viper.AddConfigPath(".")
 	viper.AddConfigPath("/usr/local/getwtxt")
 	viper.AddConfigPath("/etc")