blahrs/blahd/config.example.toml
oxalica bc6e6c2056 refactor(webapi,types)!: make challenge type extensive
We may allow more challenge types other than PoW in the future, eg.
captcha. So make the relevent types more generic.

Now the challenge is returned in JSON response as a individual top-level
field `register_challenge` instead of in HTTP headers.
2024-10-01 05:26:00 -04:00

95 lines
3.2 KiB
TOML

# The example configuration file, required options are documented as
# `(Required)`, other options are optional and the example value given here is
# the default value, or example values for commented lines.
[database]
# If enabled, a in-memory non-persistent database is used instead. Options
# `path` and `create` are ignored. This should only be used for testing.
in_memory = false
# The path to the main SQLite database.
# The file will be created and initialized if not exist, but missing directory
# will not.
path = "/var/lib/blahd/db.sqlite"
# Whether to create and initialize the database if `path` does not exist.
# Note that parent directory will never be created and must already exist.
create = true
# Listener socket configuration. (Required)
# There must be exact one option under this section being set.
[listen]
# Listen on an address.
address = "localhost:8080"
# Use systemd socket activation mechanism to get listener fd from envvars.
# See also sd_listen_fds(3) and systemd.socket(5).
# NB. Currently only TCP sockets are supported. UNIX domain socket is TODO.
#systemd = true
[server]
# (Required)
# The global absolute URL prefix where this service is hosted.
# It is for link generation and must not have trailing slash.
base_url = "http://localhost:8080"
# Maximum number of items in a single response, eg. get chat items.
# More items will be paged.
max_page_len = 1024
# Maximum request body length in bytes.
max_request_len = 4096
# The maximum timestamp tolerance in seconds for request validation.
# NB. This should be small enough to reject timestamps overflowing `i64`,
# otherwise it may cause panics.
timestamp_tolerance_secs = 90
[server.feed]
# Additional page length limit for room feed.
# Feed are fetched frequently and older items are rarely useful. You do want a
# large response for feed.
max_page_len = 64
[server.ws]
# The max waiting time for the first authentication message for websocket.
auth_timeout_sec = 15
# The max waiting time for outgoing message to be received for websocket.
send_timeout_sec = 15
# Maximum number of pending events a single user can have.
# If events overflow the pending buffer, older events will be dropped and
# client will be notified.
event_queue_len = 1024
[server.register]
# Allow public registration.
enable_public = false
# The timeout in seconds for fetching user `id_url`.
request_timeout_secs = 5
# The maximum response length in bytes of user's identity description.
max_identity_description_bytes = 65536
# [UNSAFE] Also accept HTTP `id_url`. By default only HTTPS is allowed.
# This should only be used for testing.
unsafe_allow_id_url_http = false
# [UNSAFE] Also accept `id_url` with custom port.
# This should only be used for testing.
unsafe_allow_id_url_custom_port = false
# The difficulty of Proof of Work (PoW) challenge to avoid API abuse.
# It demands at least `difficulty` number of leading zeros in SHA256.
# Currently only PoW challenge is supported.
# A zero difficulty effectively disables the challenge.
[server.register.challenge.pow]
# The difficulty.
# On average `2^difficulty` SHA256 ops are required to complete the challenge.
difficulty = 16
# The challenge nonce rotation period in seconds.
nonce_rotate_secs = 60