Skip to content

Comments

Fix: Environment variable access logic for config#127

Merged
this-Aditya merged 6 commits intodevfrom
new-env-logic
Jan 23, 2026
Merged

Fix: Environment variable access logic for config#127
this-Aditya merged 6 commits intodevfrom
new-env-logic

Conversation

@this-Aditya
Copy link
Member

The config values are only read from environment variables if they are null. This doesn’t prioritize environment variables above local config values. The logic now uses the radar-jersey helper functions to prioritize environment variables over local configuration, checking the environment variables every time.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the environment variable handling in configuration classes to properly prioritize environment variables over local configuration values. The previous implementation only read from environment variables when config values were null, which didn't allow environment variables to override non-null local config values.

Changes:

  • Changed configuration properties from mutable (var) to immutable (val) to support functional-style configuration updates
  • Replaced checkEnvironmentVars() methods with withEnv() methods using radar-jersey helper functions (copyEnv, copyOnChange)
  • Modified the configuration loading flow in Main.kt to call withEnv() during initialization rather than checking environment variables after validation

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
S3StoragePathConfig.kt Converts properties to immutable and adds withEnv() method to apply environment variable for path prefix
S3StorageConfig.kt Converts properties to immutable and adds withEnv() method to apply environment variables for S3 configuration (URL, access key, secret key, bucket name, region, and nested path config)
GatewayConfig.kt Replaces checkEnvironmentVars() with withEnv() method to propagate environment variable handling to S3 storage configuration
Main.kt Integrates withEnv() into the configuration loading chain after withDefaults() and removes the separate checkEnvironmentVars() call

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@this-Aditya this-Aditya mentioned this pull request Jan 22, 2026
Copy link
Member

@mpgxvii mpgxvii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! (Just a minor comment)

@this-Aditya this-Aditya merged commit e5b8b4a into dev Jan 23, 2026
2 of 3 checks passed
@this-Aditya this-Aditya deleted the new-env-logic branch January 23, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants