2024-01-04 15:43:40 +00:00
|
|
|
import toml
|
|
|
|
import logging
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
try:
|
|
|
|
CONFIG = toml.load('config.toml')
|
2024-01-06 21:43:52 +00:00
|
|
|
CONFIG.setdefault("logging", {})
|
|
|
|
CONFIG.setdefault("jimmy", {})
|
|
|
|
CONFIG.setdefault("ollama", {})
|
2024-01-09 16:26:18 +00:00
|
|
|
CONFIG.setdefault(
|
|
|
|
"server",
|
|
|
|
{
|
|
|
|
"host": "0.0.0.0",
|
|
|
|
"port": 8080,
|
|
|
|
"channel": 1032974266527907901
|
|
|
|
}
|
|
|
|
)
|
2024-01-04 15:43:40 +00:00
|
|
|
except FileNotFoundError:
|
|
|
|
cwd = Path.cwd()
|
|
|
|
logging.getLogger("jimmy.autoconf").critical("Unable to locate config.toml in %s.", cwd, exc_info=True)
|
|
|
|
raise
|