syncstorage-rs/docs/config.md
Ethan Donowitz 0ae5fd2059
refactor: add settings crates (#1306)
This is a breaking change. This commit separates syncstorage and tokenserver settings into separate structs that are contained by a parent `Settings` struct. This means that any env vars that hold settings specific to syncstorage (e.g. `SYNC_DATABASE_URL`) have been renamed to `SYNC_SYNCSTORAGE__DATABASE_URL`. Any settings that were moved from the top-level `Settings` struct to the lower level, syncstorage-specific struct will now have a `SYNC_SYNCSTORAGE__` prefix instead of a `SYNC_` prefix.

Closes #1276
2022-10-19 17:15:56 -04:00

1.7 KiB
Raw Blame History

Configuration

Rust uses environment variables for a number of configuration options. Some of these include:

variable value description
RUST_LOG debug, info, warn, error minimum Rust error logging level
RUST_TEST_THREADS 1 maximum number of concurrent threads for testing.

In addition, durable sync configuration options can either be specified as environment variables (prefixed with SYNC_*) or in a configuration file using the --config option.

For example the following are equivalent:

$ SYNC_HOST=0.0.0.0 SYNC_MASTER_SECRET="SuperSikkr3t" SYNC_SYNCSTORAGE__DATABASE_URL=mysql://scott:tiger@localhost/syncstorage cargo run
$ cat sync.ini
HOST=0.0.0.0
MASTER_SECRET=SuperSikkr3t

[syncstorage]
DATABASE_URL=mysql://scott:tiger@localhost/syncstorage
$ cargo run -- --config sync.ini

Options can be mixed between environment and configuration.

Options

The following configuration options are available.

Option Default value Description
debug false unused
port 8000 connection port
host 127.0.0.1 host to listen for connections
database_url mysql://root@127.0.0.1/syncstorage database DSN
database_pool_max_size None Max pool of database connections
master_secret None Sync master encryption secret
limits.max_post_bytes 2,097,152 Largest record post size
limits.max_post_records 100 Largest number of records per post
limits.max_records_payload_bytes 2,097,152 Largest ...
limits.max_request_bytes 2,101,248 Largest ...
limits.max_total_bytes 209,715,200 Largest ...
limits.max_total_records 100,000 Largest ...