27 lines
730 B
Python
27 lines
730 B
Python
from flask import Flask
|
|
from .config import load_config
|
|
|
|
|
|
def create_app(config_override=None) -> Flask:
|
|
app = Flask(
|
|
__name__,
|
|
static_folder="static",
|
|
template_folder="templates",
|
|
)
|
|
|
|
cfg = config_override or load_config()
|
|
# Map to Flask app.config for easy access in templates/routes
|
|
app.config["KB_VAULT_PATH"] = cfg.VAULT_PATH
|
|
app.config["SECRET_KEY"] = cfg.SECRET_KEY
|
|
app.config["DEBUG"] = cfg.DEBUG
|
|
|
|
# Register blueprints
|
|
from .routes.home import bp as home_bp
|
|
app.register_blueprint(home_bp)
|
|
|
|
# Simple health endpoint
|
|
@app.get("/healthz")
|
|
def healthz():
|
|
return {"status": "ok", "vault": app.config.get("KB_VAULT_PATH")}, 200
|
|
|
|
return app |