~fluix/tilde

36aec7f1fc9ff0d1cca5e29bda1698fd1dcd2fc9 — Steven Guikal 7 months ago 0ac7f6e
Switch to pyfile config files
3 files changed, 3 insertions(+), 33 deletions(-)

M .gitignore
M app.py
D config/defaults.py
M .gitignore => .gitignore +1 -1
@@ 6,4 6,4 @@ __pycache__/
env/
uploads/
dump.rdb
config.toml
config

M app.py => app.py +2 -3
@@ 2,7 2,6 @@
#
# SPDX-License-Identifier: AGPL-3.0-only

import toml
import logging
import core
import redis


@@ 16,9 15,9 @@ logger = logging.getLogger(__name__)

app = Flask(__name__, subdomain_matching=True)
app.config.from_pyfile("config.defaults")
for location in ["config.toml", "/etc/tilde/config.toml"]:
for location in ["config", "/etc/tilde/config"]:
    try:
        app.config.from_file(location, load=toml.load)
        app.config.from_pyfile(location)
    except FileNotFoundError:
        logger.warning(f"Could not find configuration file at '{location}'.")
    else:

D config/defaults.py => config/defaults.py +0 -29
@@ 1,29 0,0 @@
# Full hostname (including port if not 80/443)
SERVER_NAME = "cats.sh.localhost:5000"

# Must be set to allow subdomains to access session cookies
SESSION_COOKIE_DOMAIN = "cats.sh.localhost"

# Cats!
SERVER_BANNER = """
          ██████╗ █████╗ ████████╗███████╗   ███████╗██╗  ██╗         
         ██╔════╝██╔══██╗╚══██╔══╝██╔════╝   ██╔════╝██║  ██║   /\_/\ 
 /\_/\   ██║     ███████║   ██║   ███████╗   ███████╗███████║  ( o.o )
( u.u )  ██║     ██╔══██║   ██║   ╚════██║   ╚════██║██╔══██║   > ^ < 
 > ^ <   ╚██████╗██║  ██║   ██║   ███████║██╗███████║██║  ██║         
          ╚═════╝╚═╝  ╚═╝   ╚═╝   ╚══════╝╚═╝╚══════╝╚═╝  ╚═╝         
"""

# Root upload path for all services
MEDIA_ROOT = "./uploads/"

# Store login 'next' parameter in sessions instead of URL to remove necessity
# of checking safetyness.
USE_SESSION_FOR_NEXT = True

# Redis as a database
REDIS = {
    "host": "127.0.0.1",
    "port": 6379,
    "db": 0,
}