chore: env path refactor (#3691)
Co-authored-by: Suchintan <suchintan@users.noreply.github.com> Co-authored-by: Shuchang Zheng <wintonzheng0325@gmail.com>
This commit is contained in:
@@ -2,10 +2,22 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
from skyvern import constants
|
||||
from skyvern.constants import SKYVERN_DIR
|
||||
from skyvern.utils.env_paths import resolve_backend_env_path
|
||||
|
||||
# NOTE: _DEFAULT_ENV_FILES resolves .env paths at import time and assumes
|
||||
# the process has changed dir to the desired project root by this time.
|
||||
# Even if we were to resolve paths at instantiation time, the global `settings`
|
||||
# singleton instantiation at the bottom of this file also runs at import time
|
||||
# and relies on the same assumption.
|
||||
_DEFAULT_ENV_FILES = (
|
||||
resolve_backend_env_path(".env"),
|
||||
resolve_backend_env_path(".env.staging"),
|
||||
resolve_backend_env_path(".env.prod"),
|
||||
)
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(env_file=(".env", ".env.staging", ".env.prod"), extra="ignore")
|
||||
model_config = SettingsConfigDict(env_file=_DEFAULT_ENV_FILES, extra="ignore")
|
||||
|
||||
# settings for experimentation
|
||||
ENABLE_EXP_ALL_TEXTUAL_ELEMENTS_INTERACTABLE: bool = False
|
||||
|
||||
Reference in New Issue
Block a user