55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
# -*- coding: utf-8 -*-
|
|
# type: ignore
|
|
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 DockerDatabaseSecrets(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', 'hotpocket'),
|
|
'user': os.getenv('HOTPOCKET_BACKEND_DATABASE_USER', 'hotpocket'),
|
|
'password': os.getenv('HOTPOCKET_BACKEND_DATABASE_PASSWORD', 'hotpocketm4st3r'),
|
|
'host': os.getenv('HOTPOCKET_BACKEND_DATABASE_HOST', 'postgres.hotpocket.work.bthlabs.net'),
|
|
'port': os.getenv('HOTPOCKET_BACKEND_DATABASE_PORT', '5432'),
|
|
}),
|
|
)
|
|
|
|
|
|
class DockerOIDCSecrets(OIDCSecrets):
|
|
payload: str = LiteralField.new(
|
|
json.dumps({
|
|
'endpoint': os.getenv(
|
|
'HOTPOCKET_OIDC_ENDPOINT',
|
|
'https://auth.hotpocket.work.bthlabs.net:8443/realms/hotpocket-development',
|
|
),
|
|
'key': os.getenv('HOTPOCKET_OID_KEY', 'hotpocket-backend'),
|
|
'secret': os.getenv('HOTPOCKET_OIDC_SECRET', 'eAIhyioDjtlbUJnehIEzKt6ONQtMNs1P'),
|
|
'display_name': 'auth.hotpocket.work',
|
|
}),
|
|
)
|
|
|
|
|
|
class DockerCelerySecrets(CelerySecrets):
|
|
broker_url: str = EnvField.new(
|
|
'HOTPOCKET_BACKEND_CELERY_BROKER_URL',
|
|
default='amqp://hotpocket:hotpocketm4st3r@rabbitmq.hotpocket.work.bthlabs.net/hotpocket',
|
|
required=False,
|
|
)
|
|
result_backend: str = EnvField.new(
|
|
'HOTPOCKET_BACKEND_CELERY_RESULT_BACKEND',
|
|
default='db+postgresql+psycopg://hotpocket:hotpocketm4st3r@postgres.hotpocket.work.bthlabs.net/hotpocket',
|
|
required=False,
|
|
)
|