forked from mtusi2026/mtusi2026lab7
feat: load process secrets from OpenBao via cert auth
OpenBao 2.7.3 (raft, TLS 1.3 with client certificates) holds the PostgreSQL role passwords, the Valkey password and the S3 keys; each process logs in with its own mTLS identity, reads only its paths and renews its token in the background. Operator init, unseal, configure and seed go through infra/openbao/bao.py and make bao_*; checks are make bao_check and driver.py openbao-outage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
"""Хранилище объектов процесса API (S3).
|
||||
|
||||
Создаётся при импорте по `settings.s3`; клиент aiobotocore создаёт
|
||||
lifespan (`start()`), соединения — первый вызов. Импортируют модуль
|
||||
только `src/main.py` (старт и закрытие в lifespan) и
|
||||
`src/api/dependencies.py`, как `src/infra/cache/instance.py`. Ключи
|
||||
объектов — по имени базы из `settings.database`: `make test_isolated` с
|
||||
базой `test_<db>` пишет под своим префиксом.
|
||||
Создаётся при импорте по секции `s3` с ключами пользователя API из OpenBao
|
||||
(change `openbao-secrets`, design, решение 9); клиент aiobotocore создаёт
|
||||
lifespan (`start()`), соединения — первый вызов. Импортируют модуль только
|
||||
`src/main.py` (старт и закрытие в lifespan) и `src/api/dependencies.py`, как
|
||||
`src/infra/cache/instance.py`. Ключи объектов — по имени базы из
|
||||
`settings.database`: `make test_isolated` с базой `test_<db>` пишет под своим
|
||||
префиксом.
|
||||
"""
|
||||
|
||||
from src.config import settings
|
||||
from src.infra.s3.client import create_object_storage
|
||||
from src.infra.secrets import process_secrets
|
||||
|
||||
object_storage = create_object_storage(
|
||||
settings.s3,
|
||||
process_secrets("api").s3,
|
||||
namespace=settings.database.name,
|
||||
ca_file=settings.client_tls.ca_file,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user