9c731d6e67
Build and Push Docker Container / build-and-push (push) Failing after 51s
- Register quart_common wide-event logging during app setup so every HTTP request emits one canonical structured event. - Replace the inline security middleware with reusable quart_common security middleware wiring and move skip path configuration into app constants. - Add NanoShare-specific wide-event context for health checks, auth/error handlers, file list/edit/delete/serve flows and upload outcomes. - Rename runtime logging/project metadata from simple-picoshare to nanoshare where it is emitted in service context. - Update my_helpers and quart_common submodules for Convex/wide-event integration and reusable security middleware support. - Add NanoShare middleware tests covering safe user context, client IP enrichment, missing Convex handling and Convex security lookup failures.
28 lines
933 B
Python
28 lines
933 B
Python
from my_modules.TheIPManager import TheIPManager
|
|
from my_modules.app.logger import logger
|
|
|
|
from dotenv import find_dotenv, load_dotenv, dotenv_values
|
|
import os, asyncio
|
|
|
|
async def read_dot_file():
|
|
if load_dotenv(find_dotenv()):
|
|
dot_env_file = find_dotenv()
|
|
await logger.info(f'Found dotenv File: {dot_env_file}')
|
|
await logger.info(f'Loaded Content: {dict(dotenv_values(dot_env_file))}')
|
|
|
|
asyncio.run(read_dot_file())
|
|
|
|
WEB_DEBUG = os.getenv("WEB_DEBUG", False)
|
|
|
|
SECRET_KEY = os.getenv("FLASK_SECRET_KEY", "USE_ENV_das_ist_ein_geheimer_schlüssel_1")
|
|
API_GROUP = os.getenv("API_GROUP", 'NanoShare')
|
|
|
|
THE_IP_BOT_MANAGER = TheIPManager()
|
|
|
|
SKIP_PATH_PREFIXES = ("/static", "/storage")
|
|
SKIP_PATHS = ("/favicon.ico",)
|
|
|
|
# Blocke IPs (Bots, Hackers)
|
|
BLOCKED_IPS_ACCESSING_TIMES = int(os.getenv("BLOCKE_IPS_AFTER_ACCESSING_HOWMANY_TIME", 5))
|
|
BLOCKED_IPS_STORED_TIMEFRAME = int(os.getenv("BLOCKE_IPS_STORE_KEYS_TIMEFRAME", 3600))
|