hotpocket/services/backend/hotpocket_backend/secrets/deployment/common.py
Tomek Wójcik b4338e2769
Some checks failed
CI / Checks (push) Failing after 13m2s
Release v1.0.0
2025-08-20 21:00:50 +02:00

46 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import annotations
import json
import os
from keep_it_secret import EnvField, LiteralField
from hotpocket_backend.secrets.base import (
CelerySecrets,
DatabaseSecrets,
OIDCSecrets,
)
class DeploymentDatabaseSecrets(DatabaseSecrets):
payload: str = LiteralField.new(
json.dumps({
'engine': os.getenv('HOTPOCKET_BACKEND_DATABASE_ENGINE', 'django.db.backends.postgresql'),
'name': os.getenv('HOTPOCKET_BACKEND_DATABASE_NAME', ''),
'user': os.getenv('HOTPOCKET_BACKEND_DATABASE_USER', ''),
'password': os.getenv('HOTPOCKET_BACKEND_DATABASE_PASSWORD', ''),
'host': os.getenv('HOTPOCKET_BACKEND_DATABASE_HOST', ''),
'port': os.getenv('HOTPOCKET_BACKEND_DATABASE_PORT', '5432'),
}),
)
class DeploymentOIDCSecrets(OIDCSecrets):
payload: str | None = EnvField.new(
'HOTPOCKET_BACKEND_OIDC_PAYLOAD', default=None, required=False,
)
class DeploymentCelerySecrets(CelerySecrets):
broker_url: str = EnvField.new(
'HOTPOCKET_BACKEND_CELERY_BROKER_URL',
default=None,
required=False,
)
result_backend: str = EnvField.new(
'HOTPOCKET_BACKEND_CELERY_RESULT_BACKEND',
default=None,
required=False,
)