Skip to content

Commit

Permalink
bump example config
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunsi committed Dec 23, 2024
1 parent 7a13465 commit 4d01f69
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
8 changes: 8 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
with open(environ["SETTINGS"]) as f:
CONFIG = toml_load(f.read())

# set a bunch of defaults to make the remaining code more readable
for i in ("ADMIN_USERS", "NO_LIMIT_USERS", "SETUP_IDS"):
if i not in CONFIG:
CONFIG[i] = []

if "NOTIFIER" not in CONFIG:
CONFIG["notifier"] = {}

logging.basicConfig(
format="[%(levelname)s %(name)s] %(message)s",
level=logging.INFO,
Expand Down
2 changes: 1 addition & 1 deletion notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class Notifier:
def __init__(self):
self.config = CONFIG.get("NOTIFIER", {})
self.config = CONFIG["NOTIFIER"]
LOG.debug(f"init {self.config=}")

self.mqtt = None
Expand Down
25 changes: 19 additions & 6 deletions settings.example.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# This github OAuth client will be used for authentication. Create
# one at https://github.com/organizations/ACCOUNT/settings/applications
GITHUB_CLIENT_ID = ''
GITHUB_CLIENT_SECRET = ''

SESSION_COOKIE_NAME = '__Host-sess'

PREFERRED_URL_SCHEME = 'https'
Expand All @@ -14,9 +11,15 @@ PREFERRED_URL_SCHEME = 'https'
# The keys given out to users are adhoc keys based on this key.
HOSTED_API_KEY = ''

# Maximum uploads per github user
# Maximum uploads per user unless exempt by being an admin or no-limit
# user
MAX_UPLOADS = 5

# list of users with elevated permissions. scheme is
# "oauthprovider:username" ("c3voc:exampleuser")
ADMIN_USERS = []
NO_LIMIT_USERS = []

# Setup IDs using the scheduled player setup. One of the
# playlists must be named 'User Content'. Its pages will be
# autogenerated by the CMS when calling /sync
Expand All @@ -28,8 +31,8 @@ SETUP_IDS = [
# urls send to moderators.
URL_KEY = 'reallysecure'

# Uncomment to use redis as a session store
# REDIS_HOST = 'localhost'
# redis is used as session store and for caching the asset list
REDIS_HOST = 'localhost'

# Unix timestamp allows for specifying start/end time
# of uploaded content
Expand Down Expand Up @@ -70,6 +73,16 @@ CONTACT = """
"""


# oauth providers
[oauth2_providers.github]
client_id = ""
client_secret = ""

[oauth2_providers.c3voc]
client_id = ""
client_secret = ""


# extra assets. If this is empty, only the uploaded content and a notice
# on where to find the CMS will be shown. You can use this to overlay
# content on top of that content.
Expand Down
2 changes: 1 addition & 1 deletion syncer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def asset_to_tiles(asset: Asset):
return tiles


if datetime.now().minute == int(CONFIG.get("NOTIFIER", {}).get("ALERT_MINUTE", 7)):
if datetime.now().minute == int(CONFIG["NOTIFIER"].get("ALERT_MINUTE", 7)):
n = Notifier()
asset_states = {}
for asset in get_assets():
Expand Down

0 comments on commit 4d01f69

Please sign in to comment.