-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
42 lines (27 loc) · 939 Bytes
/
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
from pydantic import BaseSettings
class ProtocolBuilderConfig(BaseSettings):
CACHE_KEY: str = "service.ot-builder"
class Config:
env_prefix = "PROTOCOL_BUILDER_"
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
VIEWS_DIR: str = "src/views"
class Config:
env_prefix = "SERVER_"
class Config(BaseSettings):
version: str = "OT-2/v1alpha1"
builder: ProtocolBuilderConfig = ProtocolBuilderConfig()
cache: RedisCacheConfig = RedisCacheConfig()
pubsub: RedisPubSubConfig = RedisPubSubConfig()
server: ServerConfig = ServerConfig()
class Config:
case_sensitive = True