aboutsummaryrefslogtreecommitdiffstats
path: root/golang/cmd/fatcatd/main.go
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-09 19:25:24 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-09 19:25:24 -0700
commitc28602eba84c8c5ecfd267187ff103bb5e9d2091 (patch)
treed531cb5cc095e6e43919d87fd72bf0090f7dd1f6 /golang/cmd/fatcatd/main.go
parent12e2e04bcfb48e543d0fb2b8f45ae071363fe54e (diff)
downloadfatcat-c28602eba84c8c5ecfd267187ff103bb5e9d2091.tar.gz
fatcat-c28602eba84c8c5ecfd267187ff103bb5e9d2091.zip
viper config
Diffstat (limited to 'golang/cmd/fatcatd/main.go')
-rw-r--r--golang/cmd/fatcatd/main.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/golang/cmd/fatcatd/main.go b/golang/cmd/fatcatd/main.go
index c0668ed1..e98e0f79 100644
--- a/golang/cmd/fatcatd/main.go
+++ b/golang/cmd/fatcatd/main.go
@@ -7,6 +7,7 @@ import (
log "github.com/sirupsen/logrus"
loads "github.com/go-openapi/loads"
flags "github.com/jessevdk/go-flags"
+ "github.com/spf13/viper"
"git.archive.org/bnewbold/fatcat/golang/restapi"
"git.archive.org/bnewbold/fatcat/golang/restapi/operations"
@@ -14,6 +15,18 @@ import (
func init() {
+ viper.SetEnvPrefix("FATCAT")
+ viper.AutomaticEnv()
+ viper.SetDefault("Port", 9411)
+ viper.SetDefault("Verbose", true)
+
+ viper.SetConfigName("fatcatd.toml")
+ viper.AddConfigPath(".")
+ err := viper.ReadInConfig()
+ if err != nil {
+ log.Fatalf("Fatal error config file: %s \n", err)
+ }
+
// not default of stderr
log.SetOutput(os.Stdout);