-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from ECN/feature-implement-config-file-overrid…
…e-for-webqueue2api-configs Feature implement config file override for webqueue2api configs
- Loading branch information
Showing
2 changed files
with
22 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
from webqueue2api.parser import Item, Queue, load_queues | ||
from .config import config | ||
import configparser, sys | ||
from pathlib import Path | ||
from .config import config | ||
|
||
config_parser = configparser.ConfigParser() | ||
config_file_path = Path.joinpath(Path(sys.executable).parent.parent.parent, "webqueue2api_config.ini") | ||
|
||
if Path(config_file_path).exists(): | ||
config_parser.read(config_file_path) | ||
|
||
if config_parser.has_section("parser"): | ||
if config_parser.has_option("parser", "queue_directory"): | ||
config.parser.queue_directory = config_parser["parser"]["queue_directory"] | ||
if config_parser.has_option("parser", "queues_to_ignore"): | ||
config.parser.queues_to_ignore = config_parser["parser"]["queues_to_ignore"] | ||
|
||
if config_parser.has_section("api"): | ||
if config_parser.has_option("api", "environment"): | ||
config.api.environment = config_parser["api"]["environment"] | ||
if config_parser.has_option("api", "jwt_secret_key"): | ||
config.api.jwt_secret_key = config_parser["api"]["jwt_secret_key"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters