From 48ccd03be572bbb8f5124c1f5dcddfe7a3db8a90 Mon Sep 17 00:00:00 2001 From: Mike Bloy Date: Sat, 7 Sep 2019 09:42:14 -0500 Subject: [PATCH] add godotenv --- .gitignore | 1 + cmd/root.go | 1 + go.mod | 1 + go.sum | 2 ++ main.go | 1 + 5 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index c38d25e..234184d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ bin # Output of the go coverage tool, specifically when used with LiteIDE *.out +/.env diff --git a/cmd/root.go b/cmd/root.go index 9b50de4..8dee4c8 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -20,6 +20,7 @@ var rootCmd = &cobra.Command{ func init() { cobra.OnInitialize(initConfig) viper.SetDefault("port", 8000) + viper.SetDefault("env", "production") rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "Full path to config file") } diff --git a/go.mod b/go.mod index 2c625c4..72a23ef 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module git.bloy.org/mike/gotest go 1.12 require ( + github.com/gorilla/mux v1.7.3 github.com/kyoh86/xdg v1.0.0 github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.3.2 diff --git a/go.sum b/go.sum index edb0572..dd88a19 100644 --- a/go.sum +++ b/go.sum @@ -11,6 +11,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/kyoh86/xdg v1.0.0 h1:TD1layQ0epNApNwGRblnQnT3S/2UH/gCQN1cmXWotvE= github.com/kyoh86/xdg v1.0.0/go.mod h1:Z5mDqe0fxyxn3W2yTxsBAOQqIrXADQIh02wrTnaRM38= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= diff --git a/main.go b/main.go index 6769345..815ed33 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "git.bloy.org/mike/gotest/cmd" + _ "github.com/joho/godotenv/autoload" ) func main() {