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

Handle Numbers in Environment Variables #157

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion dbos/_dbos_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@ def _app_name_to_db_name(app_name: str) -> str:
def _set_env_vars(config: ConfigFile) -> None:
for env, value in config.get("env", {}).items():
if value is not None:
os.environ[env] = value
os.environ[env] = str(value)
3 changes: 3 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_valid_config(mocker):
foo: ${BARBAR}
bazbaz: BAZBAZ
bob: ${BOBBOB}
test_number: 123
"""
os.environ["BARBAR"] = "FOOFOO"
mocker.patch(
Expand All @@ -61,10 +62,12 @@ def test_valid_config(mocker):
assert configFile["database"]["connectionTimeoutMillis"] == 3000
assert configFile["env"]["foo"] == "FOOFOO"
assert configFile["env"]["bob"] is None # Unset environment variable
assert configFile["env"]["test_number"] == 123

_set_env_vars(configFile)
assert os.environ["bazbaz"] == "BAZBAZ"
assert os.environ["foo"] == "FOOFOO"
assert os.environ["test_number"] == "123"
assert "bob" not in os.environ


Expand Down