initial commit to push copy to codeberg
This commit is contained in:
commit
751bfe568c
20 changed files with 1364 additions and 0 deletions
34
changelog2/config/config.py
Normal file
34
changelog2/config/config.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import configparser
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def find_config():
|
||||
possible_locations = [
|
||||
Path.cwd() / "changelog-config.toml",
|
||||
Path.cwd() / "changelog2" / "changelog-config.toml",
|
||||
Path.cwd() / ".config" / "changelog-config.toml",
|
||||
Path.cwd() / ".config" / "changelog-config.toml",
|
||||
Path.home() / "changelog-config.toml",
|
||||
Path(os.getenv("CHANGELOG_CONFIG", "")),
|
||||
]
|
||||
|
||||
for location in possible_locations:
|
||||
if location.is_file():
|
||||
return str(location)
|
||||
|
||||
raise FileNotFoundError("changelog-config.toml nicht gefunden")
|
||||
|
||||
|
||||
config_path = find_config()
|
||||
|
||||
|
||||
def parse_config():
|
||||
config = configparser.ConfigParser()
|
||||
config.read(config_path)
|
||||
return {
|
||||
"REDMINE_HOST": config["DEFAULT"]["REDMINE_HOST"],
|
||||
"REDMINE_API_KEY": config["DEFAULT"]["REDMINE_API_KEY"],
|
||||
"OPENAI_API_KEY": config["DEFAULT"]["OPENAI_API_KEY"],
|
||||
"GIT_REPO_PATH": config["DEFAULT"]["GIT_REPO_PATH"],
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue