Initial commit.
This commit is contained in:
27
app/__init__.py
Normal file
27
app/__init__.py
Normal file
@@ -0,0 +1,27 @@
|
||||
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
|
Reference in New Issue
Block a user