feat: env file loading support

fix: typo
This commit is contained in:
Marcel S. Henselin 2026-05-13 09:51:04 +02:00
parent fdbef9d95e
commit a76a1220de
5 changed files with 12 additions and 2 deletions

1
.gitignore vendored
View file

@ -25,3 +25,4 @@ go.work.sum
# env file
.env
action-secretsmanager

View file

@ -67,7 +67,7 @@ func ValidateConfig(
}
if cfg.VaultPath == "" {
FatalLog("VAULT_SECRET cannot be empty, this is the key of your secret")
FatalLog("VAULT_PATH cannot be empty, this is the key of your secret")
}
InfoLog("Using Vault address: %s", cfg.VaultAddr)

1
go.mod
View file

@ -13,6 +13,7 @@ require (
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/stretchr/testify v1.10.0 // indirect

2
go.sum
View file

@ -24,6 +24,8 @@ github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4=
github.com/hashicorp/vault-client-go v0.4.3 h1:zG7STGVgn/VK6rnZc0k8PGbfv2x/sJExRKHSUg3ljWc=
github.com/hashicorp/vault-client-go v0.4.3/go.mod h1:4tDw7Uhq5XOxS1fO+oMtotHL7j4sB9cp0T7U6m4FzDY=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=

View file

@ -8,11 +8,17 @@ import (
"secretsmanager/secretsmanager"
"github.com/caarlos0/env/v11"
"github.com/joho/godotenv"
)
func main() {
err := godotenv.Load()
if err != nil {
log.Println(".env file not found, using regular environment variables")
}
var cfg config.Config
err := env.Parse(&cfg)
err = env.Parse(&cfg)
if err != nil {
log.Fatalf("Error parsing environment variables %s", err)
}