-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.py
55 lines (39 loc) · 1.48 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
import os
import environ
SECRETS_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "secrets.ini")
ENVIRONMENT = os.environ.get("ENVIRONMENT", default="testing")
ini_secrets = environ.secrets.INISecrets.from_path(SECRETS_PATH, ENVIRONMENT)
@environ.config(prefix="")
class TrackConfig:
created = environ.var(converter=int)
@environ.config(prefix="DISCORD")
class Discord:
owner_ids = environ.var(converter=set)
default_prefix = environ.var(")")
token = ini_secrets.secret(name="discord_token")
discord = environ.group(Discord)
@environ.config(prefix="REDIS")
class Redis:
port = 6379
password = ini_secrets.secret(name="redis_password")
host = ini_secrets.secret(name="redis_host")
redis = environ.group(Redis)
@environ.config(prefix="CHANNELS")
class ChannelIDs:
failed_renders = environ.var(converter=int)
channels = environ.group(ChannelIDs)
@environ.config(prefix="WG")
class Wargaming:
app_id = ini_secrets.secret(name="wg_application_id")
wg = environ.group(Wargaming)
@environ.config(prefix="TWITTER")
class Twitter:
token = ini_secrets.secret(name="twitter_bearer_token", default=None)
twitter = environ.group(Twitter)
cfg: TrackConfig = TrackConfig.from_environ(
environ={
"CREATED": 1663989263,
"DISCORD_OWNER_IDS": {212466672450142208, 113104128783159296},
"CHANNELS_FAILED_RENDERS": 1010834704804614184,
}
)