-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
56 lines (37 loc) · 1.22 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from typing import Optional
from pydantic import BaseSettings
class ForwarderConfig(BaseSettings):
CACHE_KEY: str = "service.chibio-relay.forwarder"
CHECK_INTERVAL: int = 10
DATA_DIR: str = "data"
DATA_GATEWAY_URL: str
class Config:
env_prefix = "FORWARDER_"
class ManagerConfig(BaseSettings):
CACHE_KEY: str = "service.chibio-relay.manager"
CHIBIO_SERVER_URL: str
DEVICE_NAME: Optional[str]
class Config:
env_prefix = "MANAGER_"
class RedisCacheConfig(BaseSettings):
URL: str = "redis://127.0.0.1:6379"
class Config:
env_prefix = "REDIS_CACHE_"
class RedisPubSubConfig(BaseSettings):
URL: str = "redis://127.0.0.1:6389"
class Config:
env_prefix = "REDIS_PUBSUB_"
class ServerConfig(BaseSettings):
HOST: str = "127.0.0.1"
PORT: int = 8000
class Config:
env_prefix = "SERVER_"
class Config(BaseSettings):
version: str = "ChiBio/v1alpha1"
forwarder: ForwarderConfig = ForwarderConfig()
manager: ManagerConfig = ManagerConfig()
cache: RedisCacheConfig = RedisCacheConfig()
pubsub: RedisPubSubConfig = RedisPubSubConfig()
server: ServerConfig = ServerConfig()
class Config:
case_sensitive = True