Skip to content

Commit 1afdea2

Browse files
committed
Merge #19: Update settings type to follow changes in API
5596fea feat!: [#18] udpate settings type to follow changes in API (Jose Celano) Pull request description: Update settings type to follow changes in API. ACKs for top commit: josecelano: ACK 5596fea Tree-SHA512: 3e69deeace43852a9501628c9822de7c87d8dbbcc6d39a092b615cd85235e33b1e33f7d800b32e53c0e7f9bff2e04df0eddb51506af5972c1fa8026be8271f58
2 parents 1bd3c11 + 5596fea commit 1afdea2

File tree

1 file changed

+100
-59
lines changed

1 file changed

+100
-59
lines changed

src/types/settings.ts

+100-59
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,71 @@
11
export type Settings = {
2+
logging: Logging,
3+
website: Website,
4+
tracker: Tracker,
5+
net: Network,
6+
auth: Auth,
7+
database: Database,
8+
mail: Mail,
9+
image_cache: ImageCache,
10+
api: Api,
11+
tracker_statistics_importer: TrackerStatisticsImporter
12+
}
13+
14+
export type Logging = {
215
log_level: LogLevel,
3-
website: {
4-
name: string
5-
},
6-
tracker: {
7-
url: string
8-
mode: TrackerMode
9-
api_url: string
10-
token: string
11-
token_valid_seconds: number
12-
},
13-
net: {
14-
port: number
15-
base_url: string | null
16-
},
17-
auth: {
18-
email_on_signup: EmailOnSignup
19-
min_password_length: number
20-
max_password_length: number
21-
secret_key: string
22-
},
23-
database: {
24-
connect_url: string
25-
},
26-
mail: {
27-
email_verification_enabled: boolean
28-
from: string
29-
reply_to: string
30-
username: string
31-
password: string
32-
server: string
33-
port: number
34-
},
35-
image_cache: {
36-
max_request_timeout_ms: number
37-
capacity: number
38-
entry_size_limit: number
39-
user_quota_period_seconds: number
40-
user_quota_bytes: number
41-
},
42-
api: {
43-
default_torrent_page_size: number
44-
max_torrent_page_size: number
45-
},
46-
tracker_statistics_importer: {
47-
torrent_info_update_interval: number
48-
}
16+
}
17+
18+
export type Website = {
19+
name: string
20+
}
21+
22+
export type Tracker = {
23+
api_url: string
24+
mode: TrackerMode
25+
token: string
26+
token_valid_seconds: number
27+
url: string
28+
}
29+
30+
export type Network = {
31+
base_url: string | null
32+
bind_address: string
33+
tsl: Tsl | null
34+
}
35+
36+
export type Auth = {
37+
email_on_signup: EmailOnSignup
38+
secret_key: string
39+
password_constraints: PasswordConstraints
40+
}
41+
42+
export type Database = {
43+
connect_url: string
44+
}
45+
46+
export type Mail = {
47+
email_verification_enabled: boolean
48+
from: string
49+
reply_to: string
50+
smtp: Smtp
51+
}
52+
53+
export type ImageCache = {
54+
capacity: number
55+
entry_size_limit: number
56+
max_request_timeout_ms: number
57+
user_quota_bytes: number
58+
user_quota_period_seconds: number
59+
}
60+
61+
export type Api = {
62+
default_torrent_page_size: number
63+
max_torrent_page_size: number
64+
}
65+
66+
export type TrackerStatisticsImporter = {
67+
port: number
68+
torrent_info_update_interval: number
4969
}
5070

5171
export type PublicSettings = {
@@ -55,24 +75,45 @@ export type PublicSettings = {
5575
email_on_signup: EmailOnSignup
5676
}
5777

78+
export type Tsl = {
79+
ssl_cert_path: string | null
80+
ssl_key_path: string | null
81+
}
82+
83+
export type PasswordConstraints = {
84+
max_password_length: number
85+
min_password_length: number
86+
}
87+
88+
export type Smtp = {
89+
port: number
90+
server: string
91+
credentials: Credentials
92+
}
93+
94+
export type Credentials = {
95+
password: string
96+
username: string
97+
}
98+
5899
export enum TrackerMode {
59-
Public,
60-
Private,
61-
Whitelisted,
62-
PrivateWhitelisted
100+
Public = "public",
101+
Listed = "listed",
102+
Private = "private",
103+
PrivateListed = "private_listed"
63104
}
64105

65106
export enum EmailOnSignup {
66-
Required,
67-
Optional,
68-
None
107+
Required = "required",
108+
Optional = "optional",
109+
Ignored = "ignored"
69110
}
70111

71112
export enum LogLevel {
72-
Off,
73-
Error,
74-
Warn,
75-
Info,
76-
Debug,
77-
Trace
113+
Off = "off",
114+
Error = "error",
115+
Warn = "warn",
116+
Info = "info",
117+
Debug = "debug",
118+
Trace = "trace",
78119
}

0 commit comments

Comments
 (0)