Skip to content

Commit 7e1a3b3

Browse files
committed
make Loki configuration optional
- rolled back previous commit - fewer checks for loki configuration keys
1 parent e465f8f commit 7e1a3b3

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

cogs/general.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ def get_docs_keys():
8181
docs_data = load_md_as_dict(settings.resource("docs.md"))
8282
return list(docs_data.keys())
8383

84-
LOKI_APPLICATION_NAME = settings.loki["application"]
84+
if settings.loki:
85+
LOKI_APPLICATION_NAME = settings.loki["application"]
86+
8587
class BotStats():
8688
server_count: int
8789
user_count: int
@@ -533,7 +535,8 @@ async def docs(self, inter: disnake.CommandInteraction, topic: str = commands.Pa
533535
async def update_botstats(self):
534536
logger.info("task_triggered: update_botstats()")
535537
try:
536-
await self.botstats_weekly.update(self.bot)
538+
if LOKI_APPLICATION_NAME:
539+
await self.botstats_weekly.update(self.bot)
537540
except Exception as e:
538541
await report_error("update_botstats()", e)
539542

utils/tools/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class Settings:
1313
def __init__(self):
1414
self.path = "settings.json"
15-
self.defaults = OrderedDict([ ("token", ""), ("error_logging", False), ("debug", False) ])
15+
self.defaults = OrderedDict([ ("token", ""), ("error_logging", False), ("debug", False), ("loki", OrderedDict([ ("base_url", ""), ("application", ""), ("username", ""), ("password","") ]))])
1616
if not os.path.exists(self.path):
1717
self.json_data = self.defaults
1818
self.save_settings()

0 commit comments

Comments
 (0)