Adding base logic for config handling. Adding example config to root
This commit is contained in:
16
src/service.py
Normal file
16
src/service.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from dotenv import dotenv_values
|
||||
import logging
|
||||
|
||||
from src.schema import ConfigSchema
|
||||
|
||||
logger = logging.getLogger("uvicorn")
|
||||
|
||||
|
||||
def load_config() -> ConfigSchema:
|
||||
logger.info("Loading config from .env file")
|
||||
config = dotenv_values(".env")
|
||||
return ConfigSchema(
|
||||
hostname=config["CLUSTER1_HOSTNAME"],
|
||||
username=config["CLUSTER1_USERNAME"],
|
||||
password=config["CLUSTER1_PASSWORD"],
|
||||
)
|
||||
Reference in New Issue
Block a user