# -*- 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, )