added notes to settings.yaml
moved core app config (name, version) out of settings and into app/app_settings.py added ability to brand SneakyScope to any name added caching of cert information from crt.sh (cache enable and lenght is configurable in settings.yaml) streamlined header/footer loading to be more correct
This commit is contained in:
@@ -2,15 +2,19 @@ import os
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from flask import Flask
|
||||
from datetime import datetime
|
||||
|
||||
# Local imports
|
||||
from app.utils.settings import get_settings
|
||||
from app.logging_setup import wire_logging_once, get_app_logger
|
||||
from app.app_settings import AppSettings
|
||||
|
||||
from app.blueprints.main import bp as main_bp # ui blueprint
|
||||
from app.blueprints.api import api_bp as api_bp # api blueprint
|
||||
from app.blueprints.roadmap import bp as roadmap_bp # roadmap
|
||||
|
||||
|
||||
|
||||
def create_app() -> Flask:
|
||||
"""
|
||||
Create and configure the Flask application instance.
|
||||
@@ -34,17 +38,36 @@ def create_app() -> Flask:
|
||||
if not app.secret_key:
|
||||
app_logger.warning("[init] SECRET_KEY is not set; sessions may be insecure in production.")
|
||||
|
||||
# Configure storage directory (bind-mount is still handled by sandbox.sh)
|
||||
sandbox_storage_default = Path("/data")
|
||||
app.config["SANDBOX_STORAGE"] = str(sandbox_storage_default)
|
||||
|
||||
# version
|
||||
version = f"v{AppSettings.version_major}.{AppSettings.version_minor}"
|
||||
|
||||
# allow branding for name if they don't match our name
|
||||
branded_name = settings.branding.name
|
||||
if branded_name == AppSettings.name:
|
||||
public_name = AppSettings.name
|
||||
footer = f"{AppSettings.copyright} {public_name} {version} - {AppSettings.tagline}"
|
||||
else:
|
||||
public_name = f"{branded_name}"
|
||||
link = f'<a href="{AppSettings.url}" target="_blank">{AppSettings.name}</a>'
|
||||
footer = f"{AppSettings.copyright} {public_name} powered by {link} {version} - {AppSettings.tagline}"
|
||||
|
||||
# web header / footer
|
||||
header = f"{public_name}"
|
||||
|
||||
# App metadata available to templates
|
||||
app.config["APP_NAME"] = settings.app.name
|
||||
app.config["APP_VERSION"] = f"v{settings.app.version_major}.{settings.app.version_minor}"
|
||||
app.config["APP_NAME"] = public_name
|
||||
app.config["APP_VERSION"] = version
|
||||
app.config["WEB_HEADER"] = header
|
||||
app.config["WEB_FOOTER"] = footer
|
||||
|
||||
# roadmap file
|
||||
app.config["ROADMAP_FILE"] = str(Path(app.root_path) / "docs" / "roadmap.yaml")
|
||||
|
||||
# Configure storage directory (bind-mount is still handled by sandbox.sh)
|
||||
sandbox_storage_default = Path("/data")
|
||||
app.config["SANDBOX_STORAGE"] = str(sandbox_storage_default)
|
||||
|
||||
|
||||
# Register blueprints
|
||||
app.register_blueprint(main_bp)
|
||||
|
||||
Reference in New Issue
Block a user