feat: add withdraw
This commit is contained in:
@@ -12,6 +12,10 @@ services:
|
|||||||
APP_HOST: "0.0.0.0"
|
APP_HOST: "0.0.0.0"
|
||||||
APP_PORT: "8000"
|
APP_PORT: "8000"
|
||||||
APP_WORKERS: "2"
|
APP_WORKERS: "2"
|
||||||
|
KEYDB_REMOTE_HOST: "pay_keydb"
|
||||||
|
KEYDB_REMOTE_PORT: "${KEYDB_PORT:-6380}"
|
||||||
|
KEYDB_REMOTE_PASSWORD: "${REDIS_PASSWORD}"
|
||||||
|
KEYDB_REMOTE_DB: "${REDIS_DB:-0}"
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -24,11 +28,13 @@ services:
|
|||||||
container_name: pay_keydb
|
container_name: pay_keydb
|
||||||
restart: no
|
restart: no
|
||||||
expose:
|
expose:
|
||||||
- "6379"
|
- "${KEYDB_PORT:-6380}"
|
||||||
volumes:
|
volumes:
|
||||||
- pay_keydb_data:/data
|
- pay_keydb_data:/data
|
||||||
command:
|
command:
|
||||||
- keydb-server
|
- keydb-server
|
||||||
|
- --port
|
||||||
|
- "${KEYDB_PORT:-6380}"
|
||||||
- --requirepass
|
- --requirepass
|
||||||
- ${REDIS_PASSWORD}
|
- ${REDIS_PASSWORD}
|
||||||
- --dir
|
- --dir
|
||||||
@@ -47,7 +53,7 @@ services:
|
|||||||
- "60"
|
- "60"
|
||||||
- "10000"
|
- "10000"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
test: ["CMD", "redis-cli", "-p", "${KEYDB_PORT:-6380}", "-a", "${REDIS_PASSWORD}", "ping"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 2s
|
timeout: 2s
|
||||||
retries: 20
|
retries: 20
|
||||||
|
|||||||
@@ -282,6 +282,19 @@ class Settings(BaseSettings):
|
|||||||
else:
|
else:
|
||||||
data['KEYDB_REMOTE_PASSWORD'] = None
|
data['KEYDB_REMOTE_PASSWORD'] = None
|
||||||
|
|
||||||
|
keydb_host_override = os.getenv('KEYDB_REMOTE_HOST') or data.get('KEYDB_REMOTE_HOST')
|
||||||
|
keydb_port_override = os.getenv('KEYDB_REMOTE_PORT') or data.get('KEYDB_REMOTE_PORT')
|
||||||
|
keydb_db_override = os.getenv('KEYDB_REMOTE_DB') or data.get('KEYDB_REMOTE_DB')
|
||||||
|
keydb_password_override = os.getenv('KEYDB_REMOTE_PASSWORD') or data.get('KEYDB_REMOTE_PASSWORD')
|
||||||
|
if keydb_host_override is not None and str(keydb_host_override).strip():
|
||||||
|
data['KEYDB_REMOTE_HOST'] = str(keydb_host_override).strip()
|
||||||
|
if keydb_port_override is not None and str(keydb_port_override).strip():
|
||||||
|
data['KEYDB_REMOTE_PORT'] = int(keydb_port_override)
|
||||||
|
if keydb_db_override is not None and str(keydb_db_override).strip():
|
||||||
|
data['KEYDB_REMOTE_DB'] = int(keydb_db_override)
|
||||||
|
if keydb_password_override is not None and str(keydb_password_override).strip():
|
||||||
|
data['KEYDB_REMOTE_PASSWORD'] = str(keydb_password_override).strip()
|
||||||
|
|
||||||
itpay_public_id = data.get('ITPAY_PUBLIC_ID') or os.getenv('ITPAY_PUBLIC_ID')
|
itpay_public_id = data.get('ITPAY_PUBLIC_ID') or os.getenv('ITPAY_PUBLIC_ID')
|
||||||
itpay_api_secret = data.get('ITPAY_API_SECRET') or os.getenv('ITPAY_API_SECRET')
|
itpay_api_secret = data.get('ITPAY_API_SECRET') or os.getenv('ITPAY_API_SECRET')
|
||||||
if itpay_public_id is not None and str(itpay_public_id).strip() and itpay_api_secret is not None and str(itpay_api_secret).strip():
|
if itpay_public_id is not None and str(itpay_public_id).strip() and itpay_api_secret is not None and str(itpay_api_secret).strip():
|
||||||
|
|||||||
@@ -42,6 +42,13 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
|
|||||||
|
|
||||||
app.state.redis_remote = create_redis_client(settings.KEYDB_REMOTE_URL)
|
app.state.redis_remote = create_redis_client(settings.KEYDB_REMOTE_URL)
|
||||||
app.state.redis = app.state.redis_remote
|
app.state.redis = app.state.redis_remote
|
||||||
|
try:
|
||||||
|
await app.state.redis_remote.ping()
|
||||||
|
logger.info('KeyDB connection established')
|
||||||
|
except Exception as exception:
|
||||||
|
logger.error(f'KeyDB connection failed: {exception}')
|
||||||
|
await app.state.redis_remote.aclose()
|
||||||
|
raise
|
||||||
|
|
||||||
jwt_store = JwtKeyStore(
|
jwt_store = JwtKeyStore(
|
||||||
vault_addr=settings.VAULT_ADDR,
|
vault_addr=settings.VAULT_ADDR,
|
||||||
|
|||||||
Reference in New Issue
Block a user