Added lib-secret-manager which consumes secrets after application launch
Build & Publish to GHCR / build (push) Successful in 1m33s
Build & Publish to GHCR / build (push) Successful in 1m33s
Reviewed-on: #7 Co-authored-by: florian <flo@meergans.org> Co-committed-by: florian <flo@meergans.org>
This commit was merged in pull request #7.
This commit is contained in:
1 parent
2a2954fb29
commit
455974b0dd
4 files changed
+12
-37
No files matched your search
+10
-1
@@ -5,7 +5,8 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
|
||||
from typing import Optional,List
|
||||
from pydantic import BaseModel
|
||||
from validator import is_valid_platform,is_valid_token,verify_api_key
|
||||
from secret_handler import encrypt_token
|
||||
from secret_manager.fernet_encryption import encrypt_token
|
||||
from secret_manager import cleanup_secret_files
|
||||
from db import get_db, create_connection_pool, close_connection_pool, start_healthcheck_thread
|
||||
from simple_logger_handler import setup_logger, LOG_LEVEL
|
||||
import uuid
|
||||
@@ -44,6 +45,14 @@ async def lifespan(app: FastAPI):
|
||||
|
||||
start_healthcheck_thread()
|
||||
logger.info("MySQL healthcheck thread started.")
|
||||
|
||||
SECRET_PATHS = frozenset({
|
||||
"/etc/secrets/encryption_key",
|
||||
"/etc/secrets/db_username",
|
||||
"/etc/secrets/db_password"
|
||||
})
|
||||
cleanup_secret_files(SECRET_PATHS)
|
||||
|
||||
yield
|
||||
logger.info("Closing MySQL connection pool...")
|
||||
close_connection_pool()
|
||||
|
||||
Reference in new issue
Block a user