Passed
Push — main ( a2a6f0...4d1017 )
by Jochen
02:17
created

byceps.config.models   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 100
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 68
dl 0
loc 100
rs 10
c 0
b 0
f 0
1
"""
2
byceps.config.models
3
~~~~~~~~~~~~~~~~~~~~
4
5
Configuration models
6
7
:Copyright: 2014-2024 Jochen Kupperschmidt
8
:License: Revised BSD (see `LICENSE` file for details)
9
"""
10
11
from __future__ import annotations
12
from dataclasses import dataclass
13
14
15
@dataclass(frozen=True, slots=True)
16
class BycepsConfig:
17
    locale: str
18
    propagate_exceptions: bool
19
    timezone: str
20
    secret_key: str
21
    database: DatabaseConfig
22
    debug: DebugConfig
23
    discord: DiscordConfig | None
24
    jobs: JobsConfig
25
    metrics: MetricsConfig
26
    paypal: PaypalConfig | None
27
    redis: RedisConfig
28
    smtp: SmtpConfig
29
    stripe: StripeConfig | None
30
    styleguide: StyleguideConfig
31
32
33
@dataclass(frozen=True, slots=True)
34
class DatabaseConfig:
35
    host: str
36
    port: int
37
    username: str
38
    password: str
39
    database: str
40
41
42
@dataclass(frozen=True, slots=True)
43
class DebugConfig:
44
    enabled: bool = False
45
    toolbar_enabled: bool = False
46
47
48
@dataclass(frozen=True, slots=True)
49
class DiscordConfig:
50
    enabled: bool = False
51
    client_id: str = ''
52
    client_secret: str = ''
53
54
55
@dataclass(frozen=True, slots=True)
56
class JobsConfig:
57
    asynchronous: bool = True
58
59
60
@dataclass(frozen=True, slots=True)
61
class MetricsConfig:
62
    enabled: bool = False
63
64
65
@dataclass(frozen=True, slots=True)
66
class PaypalConfig:
67
    enabled: bool = False
68
    client_id: str = ''
69
    client_secret: str = ''
70
    environment: str = ''
71
72
73
@dataclass(frozen=True, slots=True)
74
class RedisConfig:
75
    url: str
76
77
78
@dataclass(frozen=True, slots=True)
79
class SmtpConfig:
80
    host: str
81
    port: int
82
    starttls: bool
83
    use_ssl: bool
84
    username: str | None
85
    password: str | None
86
    suppress_send: bool
87
88
89
@dataclass(frozen=True, slots=True)
90
class StripeConfig:
91
    enabled: bool = False
92
    secret_key: str = ''
93
    publishable_key: str = ''
94
    webhook_secret: str = ''
95
96
97
@dataclass(frozen=True, slots=True)
98
class StyleguideConfig:
99
    enabled: bool = False
100