feat(shared): load config from str filepath

This commit is contained in:
jo 2022-01-21 16:44:51 +01:00 committed by Kyle Robbertze
parent a9449d6418
commit 27c2221a68
1 changed files with 5 additions and 2 deletions

View File

@ -2,7 +2,7 @@ import sys
from configparser import ConfigParser
from os import environ
from pathlib import Path
from typing import Any, Dict, Optional
from typing import Any, Dict, Optional, Union
from loguru import logger
@ -29,8 +29,11 @@ class BaseConfig(BaseModel):
*,
env_prefix: str = DEFAULT_ENV_PREFIX,
env_delimiter: str = "_",
filepath: Optional[Path] = None,
filepath: Optional[Union[Path, str]] = None,
) -> None:
if filepath is not None:
filepath = Path(filepath)
file_values = self._load_file_values(filepath)
env_values = self._load_env_values(env_prefix, env_delimiter)