chore: add base config and package structure

This commit is contained in:
ila
2026-07-04 23:24:51 +08:00
parent 5a7ea348e5
commit 79c57a63c5
14 changed files with 96 additions and 6 deletions
+4
View File
@@ -1,8 +1,12 @@
from flask import Flask
from app.config import BaseConfig, load_config_from_env
def create_app(config_object=None):
app = Flask(__name__)
app.config.from_object(BaseConfig)
app.config.update(load_config_from_env())
if config_object:
if isinstance(config_object, dict):
+1
View File
@@ -0,0 +1 @@
"""CHIS integration layer."""
+14
View File
@@ -1,2 +1,16 @@
import os
class BaseConfig:
JSON_AS_ASCII = False
def load_config_from_env(environ=None):
source = environ or os.environ
return {
"CHIS_BASE_URL": source.get("CHIS_BASE_URL", ""),
"CHIS_PUBLIC_KEY": source.get("CHIS_PUBLIC_KEY", ""),
"REDIS_URL": source.get("REDIS_URL", "redis://localhost:6379/0"),
"LOG_DIR": source.get("LOG_DIR", "logs"),
"ARCHIVE_DIR": source.get("ARCHIVE_DIR", "archives"),
}
+1
View File
@@ -0,0 +1 @@
"""Data mapping layer."""
+1
View File
@@ -0,0 +1 @@
"""Request middleware helpers."""
+1
View File
@@ -0,0 +1 @@
"""Persistence and cache repositories."""
+1
View File
@@ -0,0 +1 @@
"""Application service layer."""
+1
View File
@@ -0,0 +1 @@
"""Request validators."""