Skip to content

DAS_KMS_REGION_NAME documented in README but never used in code #8

Description

@ngoyal16

Problem

The DAS_KMS_REGION_NAME environment variable is documented in README.md but never used anywhere in the codebase.

Variable Default Description
DAS_KMS_REGION_NAME Region where the KMS key resides

Searching main.go, the only env vars read are:

  • DAS_FILTER_NAME (line 69)
  • DAS_RDS_RESOURCE_ID (line 79)

DAS_KMS_REGION_NAME is not referenced. This means:

  1. If the KMS key is in a different region than the Lambda execution environment, decryption will fail — there is no way to configure a KMS client with a custom region.
  2. The README is misleading — operators may set this variable expecting it to work, but it has no effect.

Proposed Solution

Option A: Wire it up (preferred)

Use DAS_KMS_REGION_NAME to initialize the KMS client with a specific region:

kmsRegion := os.Getenv("DAS_KMS_REGION_NAME")
var kmsClient *kms.Client
if kmsRegion != "" {
    kmsCfg, err := config.LoadDefaultConfig(ctx, config.WithRegion(kmsRegion))
    // ...
    kmsClient = kms.NewFromConfig(kmsCfg)
} else {
    kmsClient = kms.NewFromConfig(cfg)
}

Option B: Remove it

If the KMS key is always in the same region as the Lambda, remove DAS_KMS_REGION_NAME from the README to avoid confusion.

Acceptance Criteria

  • Either the env var is used in code, or it is removed from documentation
  • If wired up: KMS client respects the configured region
  • README accurately reflects all environment variables used by the code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconfigurationConfiguration management and env varsdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions