Skip to content

Commit

Permalink
feat!: switched config format to toml (#58)
Browse files Browse the repository at this point in the history
* feat!: switched config format to toml
* chore: bumped version to 0.5.4

BREAKING CHANGE: changes the config file used
  • Loading branch information
ErikBjare committed Jun 15, 2021
1 parent 7b5ab59 commit 6c460cb
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 20 deletions.
2 changes: 1 addition & 1 deletion aw_client/client.py
Expand Up @@ -89,7 +89,7 @@ def __init__(
"{}-at-{}-on-{}".format(self.client_name, server_host, server_port)
)

self.commit_interval = client_config.getfloat("commit_interval")
self.commit_interval = client_config["commit_interval"]

self.request_queue = RequestQueue(self)
# Dict of each last heartbeat in each bucket
Expand Down
28 changes: 15 additions & 13 deletions aw_client/config.py
@@ -1,19 +1,21 @@
from configparser import ConfigParser
from aw_core.config import load_config_toml

import aw_core.config
default_config = """
[server]
hostname = "127.0.0.1"
port = "5600"
default_client_config = ConfigParser()
default_client_config["server"] = {
"hostname": "127.0.0.1",
"port": "5600",
}
default_client_config["server-testing"] = {"hostname": "127.0.0.1", "port": "5666"}
[client]
commit_interval = 10
default_client_config["client"] = {
"commit_interval": "10",
}
default_client_config["client-testing"] = {"commit_interval": "5"}
[server-testing]
hostname = "127.0.0.1"
port = "5666"
[client-testing]
commit_interval = 5
""".strip()


def load_config():
return aw_core.config.load_config("aw-client", default_client_config)
return load_config_toml("aw-client", default_config)
39 changes: 34 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aw-client"
version = "0.5.3"
version = "0.5.4"
description = "Client library for ActivityWatch"
authors = ["Erik Bjäreholt <erik@bjareho.lt>", "Johan Bjäreholt <johan@bjareho.lt>"]
license = "MPL-2.0"
Expand Down

0 comments on commit 6c460cb

Please sign in to comment.