Skip to content

Commit

Permalink
fix: check dynamo credentials on start (#19)
Browse files Browse the repository at this point in the history
Closes #18
  • Loading branch information
lidel authored Dec 12, 2024
1 parent d711803 commit 2885689
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion acme/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package acme

import (
"fmt"
"os"
"strconv"
"strings"

Expand Down Expand Up @@ -117,12 +118,23 @@ func parse(c *caddy.Controller) (*acmeReader, *acmeWriter, error) {
if len(args) != 1 {
return nil, nil, c.ArgErr()
}
// Confirm required AWS environment variables are present
requiredVars := []string{
"AWS_REGION",
"AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY",
}
for _, v := range requiredVars {
if os.Getenv(v) == "" {
return nil, nil, fmt.Errorf("database-type dynamo: missing or empty environment variable: %s", v)
}
}

ddbClient := ddbv1.New(session.Must(session.NewSession()))
ds = ddbds.New(ddbClient, args[0])
case "badger":
if len(args) != 1 {
return nil, nil, fmt.Errorf("need to pass a path for the Badger configuration")
return nil, nil, fmt.Errorf("database-type badger: need to pass a path for the Badger configuration")
}
dbPath := args[0]
var err error
Expand Down

0 comments on commit 2885689

Please sign in to comment.