From 7697ebec1ac99415605eb9db179d5eb88941f2b5 Mon Sep 17 00:00:00 2001 From: Steve Korshakov Date: Fri, 8 Mar 2024 10:41:21 -0800 Subject: [PATCH] feat: add dotenv files --- sources/cmd/cmd.go | 6 ++++++ sources/go.mod | 1 + sources/go.sum | 2 ++ 3 files changed, 9 insertions(+) diff --git a/sources/cmd/cmd.go b/sources/cmd/cmd.go index af68916..e2b81c5 100644 --- a/sources/cmd/cmd.go +++ b/sources/cmd/cmd.go @@ -6,6 +6,7 @@ import ( "github.com/ex3ndr/datasets/project" "github.com/ex3ndr/datasets/resolver" + "github.com/joho/godotenv" "github.com/spf13/cobra" ) @@ -35,6 +36,11 @@ func syncHandler(cmd *cobra.Command, args []string) error { } func NewCLI() *cobra.Command { + + // Load dotenv + godotenv.Overload() + + // Set up logging log.SetFlags(log.LstdFlags | log.Lshortfile) cobra.EnableCommandSorting = false diff --git a/sources/go.mod b/sources/go.mod index 63ac75c..db6bcb3 100644 --- a/sources/go.mod +++ b/sources/go.mod @@ -5,6 +5,7 @@ go 1.21.6 require ( github.com/fatih/color v1.16.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/joho/godotenv v1.5.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect diff --git a/sources/go.sum b/sources/go.sum index 839d7cc..1fb2d22 100644 --- a/sources/go.sum +++ b/sources/go.sum @@ -5,6 +5,8 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=