mirror of
https://github.com/openmax-server/server.git
synced 2026-05-23 03:51:43 +03:00
feat: 23 опкод для регистрации, смс шлюз, докер
This commit is contained in:
20
sms-gateway/app/deps.py
Normal file
20
sms-gateway/app/deps.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from __future__ import annotations
|
||||
from app.config import Config, load_config
|
||||
from app.providers.registry import build_all_providers
|
||||
from app.redis_client import get_redis
|
||||
from app.service import SmsService
|
||||
|
||||
_service: SmsService | None = None
|
||||
|
||||
def init_service() -> None:
|
||||
global _service
|
||||
config = load_config()
|
||||
providers = build_all_providers(config)
|
||||
redis = get_redis()
|
||||
_service = SmsService(config, providers, redis)
|
||||
|
||||
def get_sms_service() -> SmsService:
|
||||
global _service
|
||||
if _service is None:
|
||||
init_service()
|
||||
return _service
|
||||
Reference in New Issue
Block a user