Skip to content

Commit

Permalink
update README.MD, fix debug messages, improve config parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Kariton committed Sep 25, 2023
1 parent 4d347c7 commit 3e80334
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ global: # settings to us
services: # service definition
github_release: # service name - referenced within the 'feeds' definition
service_feed: https://github.com/{{ name }}/releases.atom # where the rss feed is located
service_url: https://github.com/{{ name }} # used in the sub-title to link to the feed
service_url: https://github.com/{{ name }} # used in the subtitle to link to the feed
ntfy_icon: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
ntfy_subtitle_prefix: 🤖 GitHub Release
ntfy_subtitle_seperator: by
Expand All @@ -65,12 +65,13 @@ feeds: # feeds to monitor from those services
[...]

config:
cache_location: ~/.cache
cache_location: /data
run_on_startup: false
log_level: info
schedule: '*/30 * * * *' # crontab style expression - concurrent jobs are not possible
service_wait: 60 # time to wait between services
feed_wait: 5 # time to wait between posts of one feed
max_message_size: 4096 # max size of message for pagenation
max_attempts: 3 # retry to send message; consider failed after
retry_wait: 30 # time to wait between retrys
```
Expand Down
6 changes: 3 additions & 3 deletions rss-ntfy/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def custom_validation(config):

for feed_name, feed_config in config["feeds"].items():
if not "ntfy_topic" in feed_config:
if not "ntfy_topic" in config["services"][feed_name]:
if not "ntfy_topic" in config["services"][feed_name] and not "ntfy_topic" in config["global"]:
raise jsonschema.ValidationError("The property 'ntfy_topic' must be present in either 'global', 'feeds', or 'services'.")


Expand Down Expand Up @@ -88,12 +88,12 @@ def update_config(init=False):
if custom_config is not None:
if logger is not None:
logger.debug(f'custom_config": {json.dumps(custom_config)}')
logger.debug(f'custom_config": {json.dumps(CONFIG)}')
logger.debug(f'default_config": {json.dumps(CONFIG)}')

merged_config = merge_configurations(copy.deepcopy(DEFAULT_CONFIG), custom_config)

if logger is not None:
logger.debug(f'custom_config": {json.dumps(merged_config)}')
logger.debug(f'merged_config": {json.dumps(merged_config)}')

json_schema = load_schema(schema_path)

Expand Down

0 comments on commit 3e80334

Please sign in to comment.