generated from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.py
69 lines (49 loc) · 1.35 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
57
58
59
60
61
62
63
64
65
66
67
68
69
from functools import cached_property
from pydantic import BaseSettings
class AppSettings(BaseSettings):
port: int = 8000
test: bool = True
log_level: str = "DEBUG"
class Config:
# env_file = ".env"
env_prefix = "APP_"
class DatabaseSettings(BaseSettings):
url: str = "mongodb://localhost:27017/"
username: str = "admin"
password: str = "admin1234!"
name: str = "next_generation"
class Config:
# env_file = ".env"
env_prefix = "DB_"
class AMQPSettings(BaseSettings):
username: str = "admin"
password: str = "admin1234!"
host: str = "localhost"
port: int = "5672"
queue: str = "inobus_amqp"
exchange: str = "amq.topic"
class Config:
# env_file = ".env"
env_prefix = "AMQP_"
class MQTTSettings(BaseSettings):
username: str = "admin"
password: str = "admin1234!"
host: str = "localhost"
port: int = "18820"
class Config:
# env_file = ".env"
env_prefix = "MQTT_"
class Config:
@cached_property
def app_settings(self):
return AppSettings()
@cached_property
def db_settings(self):
return DatabaseSettings()
@cached_property
def amqp_settings(self):
return AMQPSettings()
@cached_property
def mqtt_settings(self):
return MQTTSettings()
config = Config()