You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

23 lines
939 B

import toml
def load_config (toml_file):
with open(toml_file, 'r') as f:
config = toml.load(f)
return config
CONFIG = load_config("config.toml")
API_HOST : str = CONFIG.get("api", {}).get("host", "0.0.0.0")
API_PORT : int = CONFIG.get("api", {}).get("port", 8000)
DATABASE_HOST : str = CONFIG.get("database", {}).get("host", "localhost")
DATABASE_PORT : int = CONFIG.get("database", {}).get("port", 3306)
DATABASE_USER : str = CONFIG.get("database", {}).get("user", "root")
DATABASE_PASSWORD : str = CONFIG.get("database", {}).get("password", "root")
def load_common_config ():
return {
"minSpeed": CONFIG.get("common", {}).get("minSpeed", 15),
"maxSpeed": CONFIG.get("common", {}).get("maxSpeed", 50),
"avgSpeed": CONFIG.get("common", {}).get("avgSpeed", 19),
"minRate": CONFIG.get("common", {}).get("minRate", 0.1),
"numres": CONFIG.get("common", {}).get("numres", 10)
}