Skip to content

Commit

Permalink
Added in dotenv abilities
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Anema committed Oct 22, 2018
1 parent 1369400 commit 35aa8aa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions go.mod
Expand Up @@ -11,6 +11,7 @@ require (
github.com/imdario/mergo v0.3.6
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/joho/godotenv v1.3.0
github.com/mattn/go-colorable v0.0.0-20180310133214-efa589957cd0
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Expand Up @@ -22,6 +22,8 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 h1:12VvqtR6Aowv3l/EQUlocDHW2Cp4G9WJVH7uyH8QFJE=
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
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/mattn/go-colorable v0.0.0-20180310133214-efa589957cd0 h1:cDvUG90i1ssGJGqMNx2Ubbn+bx7VOzjdvQ45zpy0X4w=
github.com/mattn/go-colorable v0.0.0-20180310133214-efa589957cd0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
Expand Down
5 changes: 5 additions & 0 deletions src/cmdutil/util.go
Expand Up @@ -10,6 +10,7 @@ import (
"sync"
"time"

"github.com/joho/godotenv"
"github.com/ryanuber/go-glob"
"github.com/vbauerster/mpb"
"github.com/vbauerster/mpb/decor"
Expand Down Expand Up @@ -179,6 +180,10 @@ func generateContexts(newClient clientFact, progress *mpb.Progress, flags Flags,
ctxs := []*Ctx{}
flagEnv := getFlagEnv(flags)

if err := godotenv.Load(); err != nil && !os.IsNotExist(err) {
return ctxs, err
}

config, err := env.Load(flags.ConfigPath)
if err != nil && os.IsNotExist(err) {
colors.ColorStdOut.Printf(
Expand Down

0 comments on commit 35aa8aa

Please sign in to comment.