Skip to content

Commit b614b35

Browse files
committed
impl: setting environment configuration to actual environment
1 parent 22cc8a4 commit b614b35

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

ocean_runner/config.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from enum import Enum
23
from logging import Logger
34
from pathlib import Path
@@ -45,6 +46,17 @@ class Environment(BaseSettings):
4546
description="Super secret secret",
4647
)
4748

49+
def model_post_init(self, context, /) -> None:
50+
for field_name, field in self.__class__.model_fields.items():
51+
value = getattr(self, field_name)
52+
53+
if value is None:
54+
continue
55+
56+
key = field.validation_alias
57+
58+
os.environ[str(key)] = str(value)
59+
4860

4961
class Config(BaseModel, Generic[InputT]):
5062
"""Algorithm overall configuration"""

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)