Skip to content

Commit 4d6f4e7

Browse files
authored
feat!: switched config format to toml (#75)
* feat!: switched config format to toml * build(deps): updated dependencies BREAKING CHANGE: changes the config file used
1 parent 2336a25 commit 4d6f4e7

File tree

2 files changed

+96
-47
lines changed

2 files changed

+96
-47
lines changed

aw_qt/config.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
from configparser import ConfigParser
21
from typing import List
32

4-
from aw_core.config import load_config
5-
import json
3+
from aw_core.config import load_config_toml
64

7-
# NOTE: Updating this won't update the defaults for users, this is an issue with how aw_core.config works
8-
default_settings = {
9-
"autostart_modules": json.dumps(
10-
["aw-server", "aw-watcher-afk", "aw-watcher-window",]
11-
),
12-
}
135

14-
default_config = ConfigParser()
15-
default_config["aw-qt"] = default_settings
16-
# Currently there's no reason to make them differ
17-
default_config["aw-qt-testing"] = default_settings
6+
default_config = """
7+
[aw-qt]
8+
autostart_modules = ["aw-server", "aw-watcher-afk", "aw-watcher-window"]
9+
10+
[aw-qt-testing]
11+
autostart_modules = ["aw-server", "aw-watcher-afk", "aw-watcher-window"]
12+
""".strip()
1813

1914

2015
class AwQtSettings:
@@ -23,9 +18,7 @@ def __init__(self, testing: bool):
2318
An instance of loaded settings, containing a list of modules to autostart.
2419
Constructor takes a `testing` boolean as an argument
2520
"""
26-
qt_config = load_config("aw-qt", default_config)
27-
config_section = qt_config["aw-qt" if not testing else "aw-qt-testing"]
21+
config = load_config_toml("aw-qt", default_config)
22+
config_section = config["aw-qt" if not testing else "aw-qt-testing"]
2823

29-
self.autostart_modules: List[str] = json.loads(
30-
config_section["autostart_modules"]
31-
)
24+
self.autostart_modules: List[str] = config_section["autostart_modules"]

poetry.lock

Lines changed: 85 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)