Add config source interface and environment variable source for config resolution#640
Merged
ubaskota merged 4 commits intosmithy-lang:config_resolution_mainfrom Feb 19, 2026
Merged
Conversation
SamRemis
approved these changes
Feb 18, 2026
Comment on lines
+32
to
+35
| config_value = os.environ.get(env_var) | ||
| if config_value is None: | ||
| return None | ||
| return config_value.strip() |
Contributor
There was a problem hiding this comment.
Alternate option, commit this if you think it's more readable. Functionally, these are equivalent, just does the same thing in two fewer lines
Suggested change
| config_value = os.environ.get(env_var) | |
| if config_value is None: | |
| return None | |
| return config_value.strip() | |
| if config_value := os.environ.get(env_var): | |
| return config_value.strip() |
jonathan343
reviewed
Feb 18, 2026
jonathan343
reviewed
Feb 18, 2026
jonathan343
reviewed
Feb 18, 2026
arandito
reviewed
Feb 18, 2026
jonathan343
approved these changes
Feb 19, 2026
Contributor
jonathan343
left a comment
There was a problem hiding this comment.
Looks good to me. There are one or two nits left you might want to consider
Comment on lines
+28
to
+29
| :returns: The value from the environment variable (or empty string if set to empty), | ||
| or None if the variable is not set. |
Contributor
There was a problem hiding this comment.
nit - feels weird to call out empty string. The only special case we need to call out is if it's not set. Everything else we just return as is set in the environment
Suggested change
| :returns: The value from the environment variable (or empty string if set to empty), | |
| or None if the variable is not set. | |
| :returns: The value from the environment variable (or None if the variable is not set). |
Author
There was a problem hiding this comment.
I considered a phrasing similar to that, but wanted to explicitly clarify that setting an environment variable to an empty string returns "".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Description of changes:
This change adds the
ConfigSourceprotocol to smithy-coreinterfaces and implementsEnvironmentSourceinsmithy-aws-corefor resolving configuration values from environment variables. Includes unit tests covering protocol compliance, key-to-env-var mapping, edge cases, and no-caching behavior.Added unit tests to validate the expected behavior. Verified that tests pass.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.