From c81a2921adeecafdc41dc7777651767f1416f980 Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Sat, 13 Apr 2024 20:17:00 +0200 Subject: [PATCH] Fix --- fastapi_file_server/core/config.py | 11 +++++++---- scripts/env.sh | 7 +------ scripts/start.sh | 4 +++- 3 files changed, 11 insertions(+), 11 deletions(-) mode change 100644 => 100755 scripts/env.sh diff --git a/fastapi_file_server/core/config.py b/fastapi_file_server/core/config.py index 95437e8..8ab32d8 100644 --- a/fastapi_file_server/core/config.py +++ b/fastapi_file_server/core/config.py @@ -1,7 +1,10 @@ from typing import Optional from pydantic import BaseModel -from pydantic_settings import BaseSettings +from pydantic_settings import ( + BaseSettings, + SettingsConfigDict, +) BotToken = str @@ -18,10 +21,10 @@ class EnvConfig(BaseSettings): TELEGRAM_CHAT_ID: int - BOT_TOKENS: Optional[list[BotToken]] + BOT_TOKENS: Optional[list[BotToken]] = None - TELETHON_APP_CONFIG: Optional[TelethonConfig] - TELETHON_SESSIONS: Optional[list[TelethonSessionName]] + TELETHON_APP_CONFIG: Optional[TelethonConfig] = None + TELETHON_SESSIONS: Optional[list[TelethonSessionName]] = None SENTRY_DSN: str diff --git a/scripts/env.sh b/scripts/env.sh old mode 100644 new mode 100755 index d2d61fc..e75e632 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -4,9 +4,4 @@ response=`curl -X 'GET' "https://$VAULT_HOST/v1/$VAULT_SECRET_PATH" -s \ -H 'accept: application/json' \ -H "X-Vault-Token: $VAULT_TOKEN"` -data=`echo $response | jq -r '.data.data'` - -for key in $(echo "$data" | jq -r 'keys[]'); do - value=$(echo "$data" | jq -r ".\"$key\"") # Corrected syntax - echo "$key"="$value" -done +echo "$(echo "$response" | jq -r '.data.data | to_entries | map("\(.key)='\''\(.value)'\''") | .[]')" diff --git a/scripts/start.sh b/scripts/start.sh index c6f334d..d9e9143 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,6 +1,8 @@ #! /usr/bin/env sh -export $(/env.sh) +/env.sh > ./.env +. ./.env +rm ./.env cd /app mkdir -p prometheus