Skip to content

Commit

Permalink
Migrating to go-envconfig
Browse files Browse the repository at this point in the history
Migrates to go-envconfig so the same environment variable parsing
library is used.
  • Loading branch information
mys721tx committed Dec 26, 2024
1 parent f8e24ce commit 7ad3a93
Show file tree
Hide file tree
Showing 23 changed files with 1,561 additions and 1,364 deletions.
11 changes: 7 additions & 4 deletions cdh.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ import (
"path/filepath"
"strings"

"github.com/caarlos0/env/v11"
"github.com/miekg/dns"
"github.com/sethvargo/go-envconfig"
gcdns "google.golang.org/api/dns/v1"
"google.golang.org/api/option"
)

type config struct {
Domains []string `env:"RENEWED_DOMAINS" envSeparator:" "`
Domains []string `env:"RENEWED_DOMAINS, delimiter= "`
Cert string `env:"RENEWED_LINEAGE"`
}

Expand Down Expand Up @@ -196,12 +196,15 @@ func main() {

var err error

ctx := context.Background()

cfg := config{}
err = env.Parse(&cfg)
if err != nil {
if err = envconfig.Process(ctx, &cfg); err != nil {
log.Fatal(err)
}

log.Println(cfg)

domains, err := readCert(cfg.Cert)
if err != nil {
log.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/mys721tx/cdh

require (
github.com/caarlos0/env/v11 v11.3.1
github.com/miekg/dns v1.1.62
github.com/sethvargo/go-envconfig v1.1.0
google.golang.org/api v0.214.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ cloud.google.com/go/auth/oauth2adapt v0.2.6 h1:V6a6XDu2lTwPZWOawrAa9HUK+DB2zfJyT
cloud.google.com/go/auth/oauth2adapt v0.2.6/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8=
cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I=
cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg=
github.com/caarlos0/env/v11 v11.3.1 h1:cArPWC15hWmEt+gWk7YBi7lEXTXCvpaSdCiZE2X5mCA=
github.com/caarlos0/env/v11 v11.3.1/go.mod h1:qupehSf/Y0TUTsxKywqRt/vJjN5nz6vauiYEUUr8P4U=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
Expand All @@ -31,6 +29,8 @@ github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ=
github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sethvargo/go-envconfig v1.1.0 h1:cWZiJxeTm7AlCvzGXrEXaSTCNgip5oJepekh/BOQuog=
github.com/sethvargo/go-envconfig v1.1.0/go.mod h1:JLd0KFWQYzyENqnEPWWZ49i4vzZo/6nRidxI8YvGiHw=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
Expand Down
28 changes: 0 additions & 28 deletions vendor/github.com/caarlos0/env/v11/.editorconfig

This file was deleted.

5 changes: 0 additions & 5 deletions vendor/github.com/caarlos0/env/v11/.gitignore

This file was deleted.

32 changes: 0 additions & 32 deletions vendor/github.com/caarlos0/env/v11/.golangci.yml

This file was deleted.

5 changes: 0 additions & 5 deletions vendor/github.com/caarlos0/env/v11/.goreleaser.yml

This file was deleted.

7 changes: 0 additions & 7 deletions vendor/github.com/caarlos0/env/v11/.mailmap

This file was deleted.

21 changes: 0 additions & 21 deletions vendor/github.com/caarlos0/env/v11/LICENSE.md

This file was deleted.

37 changes: 0 additions & 37 deletions vendor/github.com/caarlos0/env/v11/Makefile

This file was deleted.

156 changes: 0 additions & 156 deletions vendor/github.com/caarlos0/env/v11/README.md

This file was deleted.

Loading

0 comments on commit 7ad3a93

Please sign in to comment.