Skip to content

Commit

Permalink
feat: load .env if present (#20)
Browse files Browse the repository at this point in the history
this makes secret management easier when dealing with containers
and not wanting to pass them as cli params
  • Loading branch information
lidel authored Dec 12, 2024
1 parent 2885689 commit 35d4b4e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ p2p-forge
p2p-forge-certs/
badger.libp2p-direct-challenges/
registration_libp2p_direct-certs/
.env
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/ipfs/go-ds-badger4 v0.1.5
github.com/ipfs/go-ds-dynamodb v0.2.0
github.com/ipfs/go-log/v2 v2.5.1
github.com/joho/godotenv v1.5.1
github.com/letsencrypt/pebble/v2 v2.6.0
github.com/libp2p/go-libp2p v0.37.2
github.com/mholt/acmez/v2 v2.0.3
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
_ "github.com/coredns/coredns/core/plugin" // Load all managed plugins in github.com/coredns/coredns.
_ "github.com/ipshipyard/p2p-forge/acme"
_ "github.com/ipshipyard/p2p-forge/ipparser"
"github.com/joho/godotenv"

"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain"
Expand Down Expand Up @@ -38,5 +39,9 @@ func init() {

func main() {
fmt.Printf("%s %s\n", name, version) // always print version
err := godotenv.Load()
if err == nil {
fmt.Println(".env found and loaded")
}
coremain.Run()
}

0 comments on commit 35d4b4e

Please sign in to comment.