-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.tpl.toml
More file actions
226 lines (169 loc) · 8.15 KB
/
config.tpl.toml
File metadata and controls
226 lines (169 loc) · 8.15 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
[app]
testing = false
secret = 'DEFAULT_CHANGE_ME' # python -c "import secrets as s; print(s.token_hex(24))"
validate_boards_db = true
autoreload = false
api = false # serve catalog.json, thread.json, index.json ?
url = 'http://127.0.0.1:9001' # 'http://127.0.0.1:9001' 'https://192.168.1.100' 'https://ayasequart.com' # everything before the paths/querystrings in your url
port = 9001
# ssl_key = 'key.pem'
# ssl_cert = 'cert.pem'
proxy_trusted_hops = 0
# rate limit endpoints?
# all rates are currently hard coded
# adding configs for each endpoint would be an appreciated contribution
rate_limiter = true
# tells web crawlers if they can crawl your site or not, when they ask
allow_robots = false # robots.txt
# you can change this to increase your security
login_endpoint = '/login'
[site]
name = 'Ayase Quart'
theme = 'tomorrow' # 'tomorrow' 'yotsuba' 'yotsuba_b' 'futaba' 'burichan' 'photon'
site_email = ''
anonymous_username = 'Anonymous'
# custom_banner = 'Important message!' # html, empty string ('') to disable, default None == promo banner
[archive]
type = 'yotsuba' # 'yotsuba' (4chan), 'vichan' (lainchan, holotower)
canonical_name = '4chan' # '4chan', 'Lainchan', 'Holotower'
canonical_host = 'https://boards.4chan.org'
comments_preescaped = false # false (4chan scrapers), true (vichan APIs)
# catalog_path = '/catalog.html' # after /{board} default '/catalog'
# thread_path = '/res/{thread}.html' # after /{board} default '/thread/{thread}'
# post_path = '#{num}' # after thread_path default '#p{num}'
[stats]
enabled = true # true/false - allow endpoints for users to view [(posts / YYYY-MM) / board]
redis = true
redis_db = 2
[db]
db_type = 'mysql' # mysql, sqlite, postgresql
echo = false # if true, print rendered sql statements to console
[db.mysql] # follow pymysql/aiomysql connection keys
host = '127.0.0.1'
port = 3306
# unix_socket = '/var/run/mysqld/mysqld.sock'
db = 'asagi'
user = 'asagi'
password = 'asagi'
minsize = 1
maxsize = 50
[db.sqlite] # follow aiosqlite connection keys
database = 'path/to/file.db'
[db.postgresql] # follow aiosqlite connection keys
host = 'localhost' # also used for unix domain socket
port = 5432
user = 'asagi'
password = 'asagi'
database = 'asagi'
min_size = 1
max_size = 50
# creates a connection pool per db per process
# db is set per functionality (ex: [moderation])
[redis] # follow coredis connection keys
host = "127.0.0.1"
port = 6379
max_connections = 1000 # ensure max open file is high enough on linux (ulimit)
[media]
# 'asagi' (default) = /<media_root_path>/<board_shortname>/[image|thumb]/media_orig[:4]/media_orig[4:6]/media_orig
# 'sutra' = /<media_root_path>/[img|thb]/media_hash[0:2]/media_hash[2:4]/media_hash[4:6]/media_hash
media_fp = 'asagi' # 'asagi' 'sutra'
# `endpoint` serves content from your filesystem at the endpoint /<endpoint>/<board>/[image|thumb]/...
endpoint = '/srv/media'
# if your goal is to serve content from '/srv/media/<board>/image' set this to '/srv/media'
# then declare the two routes like below
# image_uri = "/<endpoint>/{board}/image" # e.g. "/srv/media/{board}/image"
# thumb_uri = "/<endpoint>/{board}/thumb" # e.g. "/srv/media/{board}/thumb"
# set image_uri or thumb_uri to '' if you don't want any boards to serve image, or thumb media, respectively
image_uri = '/srv/media/{board}/image' # must contain {board} if media_fp = asagi
thumb_uri = '/srv/media/{board}/thumb' # must contain {board} if media_fp = asagi
# if you your goal is to serve media from another url, use this
# image_uri = 'http://192.168.1.16:9003/srv/{board}/image' # must contain {board} if media_fp = asagi
# thumb_uri = 'http://192.168.1.16:9003/srv/{board}/thumb' # must contain {board} if media_fp = asagi
# Below are optional settings for serving media outside the quart app's static path
# i.e. outside of '/path/to/ayase_quart/src/static'
serve_outside_static = false # true, false
# `media_root_path` is the full path to the root media directory on your server
# i.e. if you have images like '/mnt/dl/<board>/image' set this to '/mnt/dl'
media_root_path = ''
# only serve files with these extension from outside the static path
valid_extensions = ['jpg', 'jpeg', 'png', 'gif', 'webm', 'mp4']
# The default is to serve media from all boards [Aside: set image_uri or thumb_url to '' to not serve the images, or thumbs, respectively]
# You can specify a subset of boards with a whitelist
boards_with_image = '' # comma separated list of board shortnames like '' or 'a,o'
boards_with_thumb = '' # comma separated list of board shortnames like '' or 'g,ck,o'
# by default, Quart will serve media files by reading them into memory
# you can avoid that with nginx's sendfile()
# https://nginx.org/en/docs/http/ngx_http_core_module.html#internal
use_nginx_sendfile = false
nginx_x_accel_redirect_path = '' # e.g. '/x_accel_redirect1'
# Put this in your nginx server block,
# location /x_accel_redirect1/ { # start and ends with /
# internal;
# alias /; # root media directory, start and ends with /
# sendfile on;
# sendfile_max_chunk 1m; # set this and other configs you do/dont want
# tcp_nopush on;
# }
[vanilla_search]
enabled = true
highlight = false # highlight results?
hits_per_page = 50
max_hits = 1_000
multi_board_search = false # allow searching multiple boards at once?
[index_search]
enabled = true
highlight = false # highlight results?
hits_per_page = 50
max_hits = 1_000
provider = 'lnx' # 'lnx', 'meili', 'typesense'
host = 'http://localhost:8000' # index search host. It should really be a LAN IP address like '192.168.1.122' - not 'localhost', nor a domain name.
headers = { content-type = 'application/json', Authorization = 'password' }
version = '1' # only matters for quickwit
multi_board_search = true # allow searching multiple boards at once?
[index_search.lnx]
max_concurrency = 4 # default 4, good range = 4-16, keep low for larger datasets to prevent io & lock contention, otherwise higher to scale requests/s
reader_threads = 8 # vcpus, default 4
writer_threads = 8 # vcpus, default 4
writer_buffer = 2_147_483_648 # bytes before mandatory block compaction & disk flush, plan for extra overhead, default 268_435_456 (256MB)
[search_plugins]
enabled = false # if true, load search plugins from the plugins directory
[moderation]
enabled = true # true, false
api = false # true, false
admin_user = 'admin'
admin_password = 'admin'
hide_post_if_reported = true # true, false
# if a post is reported N times from different IPs, then hide it
# 'hide_post_if_reported' takes precedence
n_reports_then_hide = 1
hide_upstream_deleted_posts = true # hide upstream staff deleted posts in archive
remove_replies_to_hidden_op = true # true, false # If remove_op_replies is true, then replies to hidden OPs are also hidden
filter_cache_type = 'sqlite' # 'sqlite', 'redis'
regex_filter = '' # never serve posts matching this regex pattern e.g. 'gentoo|based'
path_to_regex_so = '' # download from https://github.com/asg017/sqlite-regex/releases
# path where hidden images should go
# if empty, images can still be served if their URLs are known
hidden_images_path = '' # e.g. '/home/garbage/disposal'
[moderation.sqlite]
database = 'path/to/moderation.db' # path to the moderation database
# Use redis to cache user auth and filter reported posts
# Ensure redis connection is valid (see [redis])
[moderation.redis]
db = 4 # redis database id (default 4)
fc_key_prefix = 'filter_cache:' # (default 'filter_cache:')
fc_dump_dir = './data/filter_cache/' # (default './data/filter_cache/')
bloom_err_rate = 0.01 # 1% false positive rate (default 0.01)
bloom_init_size = 4_000_000 # Initial capacity per board (default 8_000_000)
bloom_resize_mult = 2 # Growth factor when capacity is reached (default 2)
cuckoo_capacity = 10_000 # total capacity per board (default 10_000)
cuckoo_bucket = 2000 # capacity per bucket (default 1000)
cuckoo_iter_max = 5 # bucket swaps per (board, num) (default 10)
[moderation.auth]
cookie_samesite='Strict'
cookie_secure=false # set this to true when you are using https / are in production
cookie_http_only=true # js does not need to access auth cookies
cookie_name='aq'
cookie_salt='web salt'
bearer_salt='api salt'
cookie_duration=604_800 # one week
bearer_duration=604_800 # one week