summaryrefslogtreecommitdiffstats
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
parent12e2e04bcfb48e543d0fb2b8f45ae071363fe54e (diff)
downloadfatcat-c28602eba84c8c5ecfd267187ff103bb5e9d2091.tar.gz
fatcat-c28602eba84c8c5ecfd267187ff103bb5e9d2091.zip
viper config
-rw-r--r--golang/Gopkg.lock70
-rw-r--r--golang/cmd/fatcatd/main.go13
2 files changed, 82 insertions, 1 deletions
diff --git a/golang/Gopkg.lock b/golang/Gopkg.lock
index 41e81cc2..b35747f0 100644
--- a/golang/Gopkg.lock
+++ b/golang/Gopkg.lock
@@ -26,6 +26,12 @@
version = "v0.3.3"
[[projects]]
+ name = "github.com/fsnotify/fsnotify"
+ packages = ["."]
+ revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
+ version = "v1.4.7"
+
+[[projects]]
branch = "master"
name = "github.com/go-openapi/analysis"
packages = ["."]
@@ -95,12 +101,35 @@
revision = "9286f6d0e5c1ffc7cf2bda1d59291dc3c4f2f828"
[[projects]]
+ branch = "master"
+ name = "github.com/hashicorp/hcl"
+ packages = [
+ ".",
+ "hcl/ast",
+ "hcl/parser",
+ "hcl/printer",
+ "hcl/scanner",
+ "hcl/strconv",
+ "hcl/token",
+ "json/parser",
+ "json/scanner",
+ "json/token"
+ ]
+ revision = "ef8a98b0bbce4a65b5aa4c368430a80ddc533168"
+
+[[projects]]
name = "github.com/jessevdk/go-flags"
packages = ["."]
revision = "c6ca198ec95c841fdb89fc0de7496fed11ab854e"
version = "v1.4.0"
[[projects]]
+ name = "github.com/magiconair/properties"
+ packages = ["."]
+ revision = "c3beff4c2358b44d0493c7dda585e7db7ff28ae6"
+ version = "v1.7.6"
+
+[[projects]]
branch = "master"
name = "github.com/mailru/easyjson"
packages = [
@@ -117,12 +146,51 @@
revision = "00c29f56e2386353d58c599509e8dc3801b0d716"
[[projects]]
+ name = "github.com/pelletier/go-toml"
+ packages = ["."]
+ revision = "acdc4509485b587f5e675510c4f2c63e90ff68a8"
+ version = "v1.1.0"
+
+[[projects]]
name = "github.com/sirupsen/logrus"
packages = ["."]
revision = "c155da19408a8799da419ed3eeb0cb5db0ad5dbc"
version = "v1.0.5"
[[projects]]
+ name = "github.com/spf13/afero"
+ packages = [
+ ".",
+ "mem"
+ ]
+ revision = "63644898a8da0bc22138abf860edaf5277b6102e"
+ version = "v1.1.0"
+
+[[projects]]
+ name = "github.com/spf13/cast"
+ packages = ["."]
+ revision = "8965335b8c7107321228e3e3702cab9832751bac"
+ version = "v1.2.0"
+
+[[projects]]
+ branch = "master"
+ name = "github.com/spf13/jwalterweatherman"
+ packages = ["."]
+ revision = "7c0cea34c8ece3fbeb2b27ab9b59511d360fb394"
+
+[[projects]]
+ name = "github.com/spf13/pflag"
+ packages = ["."]
+ revision = "583c0c0531f06d5278b7d917446061adc344b5cd"
+ version = "v1.0.1"
+
+[[projects]]
+ name = "github.com/spf13/viper"
+ packages = ["."]
+ revision = "b5e8006cbee93ec955a89ab31e0e3ce3204f3736"
+ version = "v1.0.2"
+
+[[projects]]
name = "github.com/tylerb/graceful"
packages = ["."]
revision = "4654dfbb6ad53cb5e27f37d99b02e16c1872fbbb"
@@ -192,6 +260,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
- inputs-digest = "909cd858ce9bdc12fadeebb01df7ee2b57ab78d03f1c6c0a1130fc56b3c9f445"
+ inputs-digest = "807f92b935a836e9a4ad4bd98cfad104e6dda33965a78bde4cb6b822c4e6d135"
solver-name = "gps-cdcl"
solver-version = 1
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);