mirror of
https://github.com/onyx-and-iris/duckypad-twitch.git
synced 2024-11-15 14:30:50 +00:00
21 lines
430 B
Python
21 lines
430 B
Python
|
from pathlib import Path
|
||
|
|
||
|
try:
|
||
|
import tomllib
|
||
|
except ModuleNotFoundError:
|
||
|
import tomli as tomllib # type: ignore
|
||
|
|
||
|
configuration = {}
|
||
|
|
||
|
configpath = Path.cwd() / "configs" / "duckypad.toml"
|
||
|
if not configpath.exists():
|
||
|
raise OSError(f"unable to locate {configpath}")
|
||
|
|
||
|
with open(configpath, "rb") as f:
|
||
|
configuration = tomllib.load(f)
|
||
|
|
||
|
|
||
|
def get(name):
|
||
|
if name in configuration:
|
||
|
return configuration[name]
|