-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ncl
More file actions
98 lines (84 loc) · 2.29 KB
/
config.ncl
File metadata and controls
98 lines (84 loc) · 2.29 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# SPDX-License-Identifier: MIT OR MPL-2.0
# Nickel configuration for vext
# Export to TOML: nickel export --format toml config.ncl > vext.toml
let IrcTarget = {
server | String,
port | Number | default = 6697,
tls | Bool | default = true,
channels | Array String,
key | String | optional,
}
let RateLimitConfig = {
messages_per_second | Number | default = 2,
burst_size | Number | default = 5,
}
let PoolConfig = {
max_connections_per_server | Number | default = 4,
connection_timeout_secs | Number | default = 30,
idle_timeout_secs | Number | default = 300,
}
let LoggingConfig = {
level | [| 'trace, 'debug, 'info, 'warn, 'error |] | default = 'info,
format | [| 'json, 'pretty, 'compact |] | default = 'pretty,
file | String | optional,
}
let VextConfig = {
# Server settings
listen_address | String | default = "127.0.0.1",
listen_port | Number | default = 6659,
# Default IRC settings
default_server | String | default = "irc.libera.chat",
default_port | Number | default = 6697,
default_tls | Bool | default = true,
# Bot identity
nick_prefix | String | default = "vext",
realname | String | default = "vext IRC notification daemon",
username | String | default = "vext",
# Rate limiting
rate_limit | RateLimitConfig | default = {},
# Connection pool
pool | PoolConfig | default = {},
# Logging
logging | LoggingConfig | default = {},
# Predefined targets (optional)
targets | Array IrcTarget | default = [],
}
# Default configuration
let default_config : VextConfig = {
listen_address = "127.0.0.1",
listen_port = 6659,
default_server = "irc.libera.chat",
default_port = 6697,
default_tls = true,
nick_prefix = "vext",
realname = "vext IRC notification daemon",
username = "vext",
rate_limit = {
messages_per_second = 2,
burst_size = 5,
},
pool = {
max_connections_per_server = 4,
connection_timeout_secs = 30,
idle_timeout_secs = 300,
},
logging = {
level = 'info,
format = 'pretty,
},
targets = [],
}
# Production configuration example
let production_config : VextConfig = default_config & {
listen_address = "0.0.0.0",
logging = {
level = 'warn,
format = 'json,
},
pool = {
max_connections_per_server = 8,
idle_timeout_secs = 600,
},
}
# Export default config
default_config