maelstrom-rs / maelstrom

High performance Matrix Home Server in rust.
Apache License 2.0
245 stars 16 forks source link

Allow load server config from file and env vars #128

Closed gnieto closed 4 years ago

gnieto commented 4 years ago

Use mehcode/config crate to configure the sources and priorites for configuration loader.

I've moved all structs on server/mod.rs to a config module and I've splitted in two distinct structures:

As CONFIG is a static value and is used as a singleton on some places, I've needed to add the MAELSTROM_CONFIG_FILE env var to allow loading from a distinct file on tests.

I wanted to ask some questions:

chrisabruce commented 4 years ago

No concerns with that Config crate or Anyhow as of now. We should use yaml. That is the default for other Home Server admins, so best to be consistent. As for prefix, probably ok. Maybe worth looking at what Synapse and Dendrite do, but we can always adjust later.

gnieto commented 4 years ago

Changed to yaml