Skip to content

Commit 6c460cb

Browse files
authored
feat!: switched config format to toml (#58)
* feat!: switched config format to toml * chore: bumped version to 0.5.4 BREAKING CHANGE: changes the config file used
1 parent 7b5ab59 commit 6c460cb

4 files changed

Lines changed: 51 additions & 20 deletions

File tree

aw_client/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(
8989
"{}-at-{}-on-{}".format(self.client_name, server_host, server_port)
9090
)
9191

92-
self.commit_interval = client_config.getfloat("commit_interval")
92+
self.commit_interval = client_config["commit_interval"]
9393

9494
self.request_queue = RequestQueue(self)
9595
# Dict of each last heartbeat in each bucket

aw_client/config.py

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

3-
import aw_core.config
3+
default_config = """
4+
[server]
5+
hostname = "127.0.0.1"
6+
port = "5600"
47
5-
default_client_config = ConfigParser()
6-
default_client_config["server"] = {
7-
"hostname": "127.0.0.1",
8-
"port": "5600",
9-
}
10-
default_client_config["server-testing"] = {"hostname": "127.0.0.1", "port": "5666"}
8+
[client]
9+
commit_interval = 10
1110
12-
default_client_config["client"] = {
13-
"commit_interval": "10",
14-
}
15-
default_client_config["client-testing"] = {"commit_interval": "5"}
11+
[server-testing]
12+
hostname = "127.0.0.1"
13+
port = "5666"
14+
15+
[client-testing]
16+
commit_interval = 5
17+
""".strip()
1618

1719

1820
def load_config():
19-
return aw_core.config.load_config("aw-client", default_client_config)
21+
return load_config_toml("aw-client", default_config)

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.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "aw-client"
3-
version = "0.5.3"
3+
version = "0.5.4"
44
description = "Client library for ActivityWatch"
55
authors = ["Erik Bjäreholt <erik@bjareho.lt>", "Johan Bjäreholt <johan@bjareho.lt>"]
66
license = "MPL-2.0"

0 commit comments

Comments
 (0)