Skip to content

Commit 92452af

Browse files
committed
feat!: switched config format to toml
BREAKING CHANGE: changes the config file used
1 parent ba60870 commit 92452af

File tree

3 files changed

+49
-22
lines changed

3 files changed

+49
-22
lines changed

aw_server/config.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
from configparser import ConfigParser
1+
from aw_core.config import load_config_toml
22

3-
from aw_core.config import load_config
3+
default_config = """
4+
[server]
5+
host = "localhost"
6+
port = "5600"
7+
storage = "peewee"
8+
cors_origins = ""
49
5-
default_config = ConfigParser()
6-
default_config["server"] = {
7-
"host": "localhost",
8-
"port": "5600",
9-
"storage": "peewee",
10-
"cors_origins": "",
11-
}
12-
default_config["server-testing"] = {
13-
"host": "localhost",
14-
"port": "5666",
15-
"storage": "peewee",
16-
"cors_origins": "",
17-
}
10+
[server-testing]
11+
host = "localhost"
12+
port = "5666"
13+
storage = "peewee"
14+
cors_origins = ""
15+
""".strip()
1816

19-
config = load_config("aw-server", default_config)
17+
config = load_config_toml("aw-server", default_config)

aw_server/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def parse_settings():
8080
configsection = "server" if not args.testing else "server-testing"
8181
settings = argparse.Namespace()
8282
settings.host = config[configsection]["host"]
83-
settings.port = config[configsection].getint("port")
83+
settings.port = int(config[configsection]["port"])
8484
settings.storage = config[configsection]["storage"]
8585
settings.cors_origins = config[configsection]["cors_origins"]
8686

poetry.lock

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

0 commit comments

Comments
 (0)