Milestone 1.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from flask import Flask
|
||||
from .config import load_config
|
||||
from .services.vault import Vault
|
||||
|
||||
|
||||
def create_app(config_override=None) -> Flask:
|
||||
@@ -10,16 +11,24 @@ def create_app(config_override=None) -> Flask:
|
||||
)
|
||||
|
||||
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
|
||||
|
||||
# Ensure vault structure early if configured
|
||||
if cfg.VAULT_PATH:
|
||||
try:
|
||||
Vault(cfg.VAULT_PATH).ensure_structure()
|
||||
except Exception:
|
||||
# Avoid crashing on startup; routes can surface errors as needed
|
||||
pass
|
||||
|
||||
# Register blueprints
|
||||
from .routes.home import bp as home_bp
|
||||
from .routes.notes import bp as notes_bp
|
||||
app.register_blueprint(home_bp)
|
||||
app.register_blueprint(notes_bp)
|
||||
|
||||
# Simple health endpoint
|
||||
@app.get("/healthz")
|
||||
def healthz():
|
||||
return {"status": "ok", "vault": app.config.get("KB_VAULT_PATH")}, 200
|
||||
|
Reference in New Issue
Block a user