Skip to content

Commit

Permalink
Add aws endpoint for compatible secrets managers
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusfcr committed Apr 4, 2024
1 parent 86653f5 commit e4c87e0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ Those are the variables you have to use:
|PG_PORT|Database port|5432|
|PG_SSLMODE|One of these (disable,allow,prefer,require,verify-ca,verify-full)|disable|
|AWSSERVERCREDENTIALS_KEY|Parent key in the AWS Secret Manager to store server secrets|/vulcan/k8s/tracker/jira/|
|AWSSERVERCREDENTIALS_ENDPOINT|Optional AWS endpoint|http://locacalstack/|
|AWS_REGION||eu-west-1|



```bash
docker build . -t vulcantracker

Expand Down
1 change: 1 addition & 0 deletions _resources/config/local.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ db = "vultrackerdb"

[aws]
server_credentials_key = "/vulcan/k8s/tracker/jira/"
endpoint = ""
region ="eu-west-1"
1 change: 1 addition & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ sslmode = "$PG_SSLMODE"

[aws]
server_credentials_key = "$AWSSERVERCREDENTIALS_KEY"
endpoint = "$AWSSERVERCREDENTIALS_ENDPOINT"
region ="$AWS_REGION"
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type logConfig struct {
// AwsConfig stores the AWS configuration.
type AwsConfig struct {
ServerCredentialsKey string `toml:"server_credentials_key"`
Endpoint string `toml:"endpoint"`
Region string `toml:"region"`
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/secrets/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ func NewAWSSecretManager(config config.AwsConfig, logger echo.Logger) (*AWSSecre
}
awsCfg := aws.NewConfig()
awsCfg = awsCfg.WithRegion(config.Region)

if config.Endpoint != "" {
awsCfg = awsCfg.WithEndpoint(config.Endpoint)
}
// Create Secrets Manager client.
client := secretsmanager.New(sess, awsCfg)
sc, err := secretcache.New(func(c *secretcache.Cache) { c.Client = client })
Expand Down

0 comments on commit e4c87e0

Please sign in to comment.