Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check dynamo credentials on start #19

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading