Skip to content

Make Flask subdomain matching configurable via SUBDOMAIN_MATCHING #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions spkrepo/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def create_app(config=None, register_blueprints=True, init_admin=True):
# Configuration
app.config.from_object(default_config)
app.config.from_envvar("SPKREPO_CONFIG", silent=True)

# Enable or disable Flask’s subdomain routing per config
app.subdomain_matching = app.config.get("SUBDOMAIN_MATCHING", False)

if config is not None:
app.config.from_object(config)

Expand Down
2 changes: 2 additions & 0 deletions spkrepo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
TESTING = False
SECRET_KEY = "secret-key"
MAX_CONTENT_LENGTH = 170 * 1024 * 1024
# Enable subdomain-based routing (False in local dev; True in prod)
SUBDOMAIN_MATCHING = False

# Application
DATA_PATH = os.path.realpath("data")
Expand Down