Commit graph

44 commits

Author SHA1 Message Date
Charles Hall
153e3e4c93
make database config a sum type
This way we don't need to construct the entire configuration to load a
database or database engine.

The other advantage is that it allows having options that are unique to
each database backend.

The one thing I don't like about this is `DatabaseConfig::path`, whose
existence implies all databases will have a file path, which is not
true for out-of-process databases. The only thing this is really used
for is creating the media directory. I think we should restructure the
configuration in the future to resolve this.
2024-10-22 10:36:04 -07:00
Charles Hall
7563360bee
move pdu_cache to service 2024-10-20 13:29:32 -07:00
Lambda
e14b7f28f2
Implement federation self-test 2024-09-27 10:51:32 -07:00
Charles Hall
e9caf228b3
move config check into config load function 2024-09-25 10:39:46 -07:00
Lambda
084d862e51
Allow configuring served components per listener 2024-09-23 16:43:52 -07:00
Lambda
0d6a7eb968 Disable unauthenticated media access 2024-09-18 20:33:28 +00:00
Charles Hall
b9ee898920
require client base_url, rename from authority
The previous code used `server_name` as a fallback but in reality there
is no real relationship between `server_name` and the location clients
are supposed to make requests to.

Additionally, the `insecure` option is gone, because we now allow users
to control the entire URL, so they're free to choose the scheme.
2024-09-18 13:03:49 -07:00
Lambda
458a7458dc Support specifying old_verify_keys in config 2024-09-13 17:02:30 +00:00
Charles Hall
449c27642c
hide sliding sync behind explicit option
We want to make sure users know this sliding sync impl is pretty buggy
before they attempt to use it.
2024-09-08 14:08:32 -07:00
Charles Hall
806cc0cb28
serve well-known client and server config
This way users can have a simpler time configuring this stuff and we can
worry about the spec compliance parts and specifying the same thing over
and over parts.
2024-09-08 13:35:38 -07:00
Lambda
14afa1357e tracing: allow configuring service name
This is essential when consuming tracing data from multiple servers.
2024-08-24 19:31:39 +00:00
avdb13
00b77144c1 chore: deprecate support for unstable room versions 2024-08-12 06:18:28 +02:00
Lambda
5a6e4fac73
Move federation config to separate config section
This renames:

allow_federation -> federation.enable
trusted_servers -> federation.trusted_servers
max_fetch_prev_events -> federation.max_fetch_prev_events
max_concurrent_requests -> federation.max_concurrent_requests
2024-06-27 16:04:23 -07:00
Lambda
e0e7d8fd91
Make observability more configurable
The following are now configurable:

- the OpenTelemetry endpoint,
- the tracing-flame filename, and
- whether the log output should include timestamps (useful to disable if
  it goes straight into journald).
2024-06-27 16:04:23 -07:00
Lambda
df571818f1
Make tracing filters configurable per backend 2024-06-27 16:04:23 -07:00
Lambda
98d49554ce
Move observability config to separate config section
This renames:

allow_prometheus -> observability.metrics.enable
allow_jaeger -> observability.traces.enable
tracing_flame -> observability.flame.enable
log -> observability.logs.filter
log_colors -> observability.logs.colors
log_format -> observability.logs.format

New config values in these sections will follow.
2024-06-27 16:04:23 -07:00
Lambda
8a30817930
config: convert database backend to enum
This reports a nice error when the config is loaded, rather than later
when the database is initialized.
2024-06-27 16:04:23 -07:00
Lambda
d26b87a2f2
Move database config to separate section
This renames:

database_backend -> database.backend
database_path -> database.path
db_cache_capacity_mb -> database.cache_capacity_mb
rocksdb_max_open_files -> database.rocksdb_max_open_files

Charles updated the NixOS module.

Co-authored-by: Charles Hall <charles@computer.surgery>
2024-06-27 16:03:43 -07:00
Lambda
79d5d306cc Move TURN config to separate config section
This renames:

turn_username -> turn.username
turn_password -> turn.password
turn_uris -> turn.uris
turn_secret -> turn.secret
turn_ttl -> turn.ttl
2024-06-27 18:16:37 +00:00
Lambda
e911518aac config: make db_cache_capacity_mb field unconditional
This is also used by sqlite, causing builds with `--no-default-features
--features sqlite` to fail.
2024-06-27 18:16:37 +00:00
Lambda
b171f7c123 config: fix order of items 2024-06-27 18:16:37 +00:00
Charles Hall
1b51e0beec
increase the default log level
The vast majority of spans are at the info level, so increasing the log
level to info will greatly increase the amount of (useful!) inforamtion
included in the logs.

However, `ruma_state_res` generates a substantial amount of logs, so
that one gets to stay fixed at `warn` for now.
2024-06-24 12:43:28 -07:00
Benjamin Lee
a909e2079b
config options for log format and color usage
We want to be able to disable colors for complement logs (since they
are likely to be opened in a text editor). There's no pressing need for
alternative log formats, but I'm interested in whether the 'pretty'
format will be easier for debugging.

I chose to add 'log_*' options rather than making a separate 'log'
section for now. There's been some discussion about trying to separate
the tracing/logging stuff into more structured sections, but that can
happen later.
2024-06-13 21:21:14 -07:00
Benjamin Lee
4f041f9153
specify listener in error messages and logs
The "listening for incoming traffic on ..." log line is new, but
something I've wanted even when we only supported one listener.

I considered getting rid of `clippy::too_many_lines` by factoring out
the construction of `app` to a separate function, but found that
specifying it's type (or relevant traits) got quite hairy.
2024-06-13 15:49:21 -07:00
Benjamin Lee
f7d7952f9b
allow listening on multiple ports in config
This is a config compatibility break.

The ability to listen on multiple ports, including both TLS and non-TLS,
is necessary for running complement against grapevine.
2024-06-13 13:33:50 -07:00
Charles Hall
85e77832e9
follow xdg base dirs spec by default 2024-06-12 19:57:00 -07:00
Charles Hall
c46eaed0e0
parse configured EnvFilter once
This allows the error handling to be done upfront instead of for each
use. In particular, the `toml` error now points to the span of text in
the config file where the misconfigured EnvFilter value is. This is much
better than the previous error that did not indicate what was actually
causing it to happen.
2024-06-12 19:56:59 -07:00
Charles Hall
6b819d6f2d
move config loading to config module
This separates concerns a bit more. We will probably want to extend the
logic for config loading in the future, and that stuff should all live
in the relevant place. This change points us in the right direction.
2024-06-12 19:56:59 -07:00
Charles Hall
44088852cf
remove show-config admin room command
Just `cat` the config file. Also this code would be very annoying to
maintain. Getting rid of this also revealed that another config option
is specific to RocksDB, so `cfg`s for that have been added.
2024-06-12 19:56:59 -07:00
Charles Hall
a6087e97e1
remove config deprecation functionality
This is a hard fork, we don't need to inherit this cruft. Really, I
should've noticed and removed this closer to the beginning of our
history.
2024-06-12 19:56:59 -07:00
Charles Hall
b34e001997
remove unused Clone derives 2024-06-12 19:56:59 -07:00
Charles Hall
0643a3f081
remove pointless pub(crate) and use self::
And also fix the ordering of things in state_compressor.
2024-06-12 19:56:56 -07:00
Charles Hall
a0b92c82e8
set up opentelemetry for metrics
Also adds an `allow_prometheus` option (disabled by default) to expose
a `/metrics` endpoint that returns Prometheus data.
2024-06-03 18:18:44 -07:00
Benjamin Lee
72962c6402
enable allow_federation config by default
We inherited the disabled-by-default setting from conduit. Conduwuit
change it to enabled-by-default in [1]. This can make things confusing
for users migrating from conduwuit to grapevine, especially since we
currently do not log a warning when federation is disabled.

[1]: 24605e151d
2024-05-30 09:30:13 -07:00
Charles Hall
0afc1d2f50
change rustfmt configuration
This change is fully automated, except the `rustfmt.toml` changes and
a few clippy directives to allow specific functions with too many lines
because they are longer now.
2024-05-16 19:11:40 -07:00
Charles Hall
1911ad34d9
stop putting comments and code on the same line 2024-05-16 15:22:35 -07:00
Charles Hall
a25f2ec950
add conduit compat mode
This makes it possible to deploy Grapevine while using a database
originally created by Conduit, including leaving the admin bot user's
localpart the same as before.
2024-05-14 20:21:51 -07:00
Charles Hall
f205280520
use the intended default port by default
Why was it not like this before? All the documentation and examples used
this as the default port.
2024-05-14 20:08:37 -07:00
Charles Hall
a569bf8d99
enable zero_sized_map_values lint 2024-05-14 20:01:25 -07:00
Charles Hall
8ef278d358
enable struct_excessive_bools lint
And ignore it in the one place it fires, I know.
2024-05-14 20:01:24 -07:00
Charles Hall
bd6ea4e358
enable format_push_string lint 2024-05-12 18:51:26 -07:00
Charles Hall
2ff08c9fc4
enable dead_code lint
And delete all the dead code. And add some cfgs for feature-specific
items.
2024-05-12 18:51:26 -07:00
Charles Hall
d748544f0e
enable unreachable_pub lint
This causes some other lints to start firing too (which is good), but
I'm going to fix them in follow-up commits to keep things organized.
2024-05-12 18:51:26 -07:00
Charles Hall
a626e7b0f0
enable mod_module_files lint 2024-05-12 18:51:26 -07:00
Renamed from src/config/mod.rs (Browse further)