listenshare-bot/app/config.py
Mootfrost d34388b3ba
All checks were successful
Deploy Service / deploy (push) Successful in 27s
Try workaround
2025-04-13 20:57:17 +03:00

40 lines
873 B
Python

import base64
from pydantic_settings import BaseSettings, SettingsConfigDict
from pydantic import BaseModel
class OauthCreds(BaseModel):
client_id: str
client_secret: str
redirect: str
@property
def encoded(self) -> str:
return base64.b64encode(self.client_id.encode() + b':' + self.client_secret.encode()).decode("utf-8")
class GoogleApiCreds(BaseModel):
client_id: str
client_secret: str
class Config(BaseSettings):
model_config = SettingsConfigDict(env_nested_delimiter='_',
env_nested_max_split=1)
bot_token: str
api_id: int
api_hash: str
db_string: str
spotify: OauthCreds
yt: GoogleApiCreds
ymusic: OauthCreds
proxy: str | None
socks_proxy: str | None
jwt_secret: str
config = Config(_env_file='.env')
__all__ = ['config', 'OauthCreds']