update dep

This commit is contained in:
Jon Lundy 2018-06-25 17:23:13 -06:00
parent 4e31982296
commit 229dd7620e
Signed by untrusted user who does not match committer: xuu
GPG Key ID: 346DF999B2530DAE
3 changed files with 58 additions and 59 deletions

32
Gopkg.lock generated
View File

@ -28,14 +28,14 @@
[[projects]] [[projects]]
name = "github.com/gorilla/context" name = "github.com/gorilla/context"
packages = ["."] packages = ["."]
revision = "1ea25387ff6f684839d82767c1733ff4d4d15d0a" revision = "08b5f424b9271eedf6f9f0ce86cb9396ed337a42"
version = "v1.1" version = "v1.1.1"
[[projects]] [[projects]]
name = "github.com/gorilla/mux" name = "github.com/gorilla/mux"
packages = ["."] packages = ["."]
revision = "53c1911da2b537f792e7cafcb446b05ffe33b996" revision = "e3702bed27f0d39777b0b37b664b6280e8ef8fbf"
version = "v1.6.1" version = "v1.6.2"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -57,20 +57,20 @@
[[projects]] [[projects]]
name = "github.com/magiconair/properties" name = "github.com/magiconair/properties"
packages = ["."] packages = ["."]
revision = "c3beff4c2358b44d0493c7dda585e7db7ff28ae6" revision = "c2353362d570a7bfa228149c62842019201cfb71"
version = "v1.7.6" version = "v1.8.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "github.com/mitchellh/mapstructure" name = "github.com/mitchellh/mapstructure"
packages = ["."] packages = ["."]
revision = "00c29f56e2386353d58c599509e8dc3801b0d716" revision = "bb74f1db0675b241733089d5a1faa5dd8b0ef57b"
[[projects]] [[projects]]
name = "github.com/pelletier/go-toml" name = "github.com/pelletier/go-toml"
packages = ["."] packages = ["."]
revision = "acdc4509485b587f5e675510c4f2c63e90ff68a8" revision = "c01d1270ff3e442a8a57cddc1c92dc1138598194"
version = "v1.1.0" version = "v1.2.0"
[[projects]] [[projects]]
name = "github.com/spf13/afero" name = "github.com/spf13/afero"
@ -78,8 +78,8 @@
".", ".",
"mem" "mem"
] ]
revision = "63644898a8da0bc22138abf860edaf5277b6102e" revision = "787d034dfe70e44075ccc060d346146ef53270ad"
version = "v1.1.0" version = "v1.1.1"
[[projects]] [[projects]]
name = "github.com/spf13/cast" name = "github.com/spf13/cast"
@ -105,17 +105,11 @@
revision = "b5e8006cbee93ec955a89ab31e0e3ce3204f3736" revision = "b5e8006cbee93ec955a89ab31e0e3ce3204f3736"
version = "v1.0.2" version = "v1.0.2"
[[projects]]
branch = "master"
name = "golang.org/x/net"
packages = ["context"]
revision = "5f9ae10d9af5b1c89ae6904293b14b064d4ada23"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "golang.org/x/sys" name = "golang.org/x/sys"
packages = ["unix"] packages = ["unix"]
revision = "cbbc999da32df943dac6cd71eb3ee39e1d7838b9" revision = "a200a19cb90b19de298170992778b1fda7217bd6"
[[projects]] [[projects]]
name = "golang.org/x/text" name = "golang.org/x/text"
@ -146,7 +140,7 @@
"stats", "stats",
"uuid" "uuid"
] ]
revision = "269d338a355c78bd998da6be806d99216b4f19a0" revision = "9487992f8fbf29e66bef06b4fa787389832193a4"
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"

View File

@ -2,8 +2,6 @@ package main
import ( import (
"bytes" "bytes"
"fmt"
"github.com/docopt/docopt.go" "github.com/docopt/docopt.go"
"github.com/spf13/viper" "github.com/spf13/viper"
"sour.is/x/toolbox/httpsrv" "sour.is/x/toolbox/httpsrv"
@ -55,6 +53,16 @@ var args map[string]interface{}
func init() { func init() {
var err error var err error
viper.Set("app.name", AppName)
viper.SetDefault("app.version", "VERSION")
if AppVersion != "" {
viper.Set("app.version", AppVersion)
}
viper.SetDefault("app.build", "SNAPSHOT")
if AppBuild != "" {
viper.Set("app.build", AppBuild)
}
if args, err = docopt.Parse(AppUsage, nil, true, AppVersion, false); err != nil { if args, err = docopt.Parse(AppUsage, nil, true, AppVersion, false); err != nil {
log.Fatal(err) log.Fatal(err)
} }
@ -68,6 +76,13 @@ func init() {
log.Debug("Debug Logging.") log.Debug("Debug Logging.")
} }
log.Printf("%s (%s %s)\n",
viper.GetString("app.name"),
viper.GetString("app.version"),
viper.GetString("app.build"))
if args["serve"] == true {
viper.SetConfigName("config") viper.SetConfigName("config")
if args["--config"] != nil { if args["--config"] != nil {
viper.AddConfigPath(args["--config"].(string)) viper.AddConfigPath(args["--config"].(string))
@ -81,39 +96,16 @@ func init() {
err = viper.MergeInConfig() err = viper.MergeInConfig()
if err != nil { // Handle errors reading the config file if err != nil { // Handle errors reading the config file
log.Fatalf("Fatal error config file: %s \n", err) log.Warningf("config file not found: %s \n", err)
} else {
log.Notice("Read config from: ", viper.ConfigFileUsed())
} }
viper.Set("app.name", AppName)
viper.SetDefault("app.version", "VERSION")
if AppVersion != "" {
viper.Set("app.version", AppVersion)
}
viper.SetDefault("app.build", "SNAPSHOT")
if AppBuild != "" {
viper.Set("app.build", AppBuild)
}
if args["serve"] == true {
if args["--listen"] != nil { if args["--listen"] != nil {
viper.Set("http.listen", args["--listen"].(string)) viper.Set("http.listen", args["--listen"].(string))
} }
log.Noticef("Startup: %s (%s %s)",
viper.GetString("app.name"),
viper.GetString("app.version"),
viper.GetString("app.build"))
log.Notice("Read config from: ", viper.ConfigFileUsed())
httpsrv.Config() httpsrv.Config()
} else if args["version"] == true {
fmt.Printf("Version: %s (%s %s)\n",
viper.GetString("app.name"),
viper.GetString("app.version"),
viper.GetString("app.build"))
} }
} }

View File

@ -30,11 +30,24 @@ import (
_ "sour.is/x/paste/src/docs" _ "sour.is/x/paste/src/docs"
_ "sour.is/x/paste/src/routes" _ "sour.is/x/paste/src/routes"
"sour.is/x/toolbox/httpsrv" "sour.is/x/toolbox/httpsrv"
"os"
"os/signal"
"syscall"
"sour.is/x/toolbox/log"
) )
func main() { func main() {
if args["serve"] == true { if args["serve"] == true {
httpsrv.Run() httpsrv.Run()
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
s := <-c
log.Debugf("Got Signal %d", s)
httpsrv.Shutdown()
log.Debug("DONE")
} }
} }