scottlamb / moonfire-nvr

Moonfire NVR, a security camera network video recorder
Other
1.22k stars 137 forks source link

config file for more flexible http server setup #133

Open scottlamb opened 3 years ago

scottlamb commented 3 years ago

Context: this comment on #132, #35 , #27, #31 .

It'd be nice to have more than a single --http-addr=ipaddr:port and allow them to differ in configuration (different --allow-unauthenticated-permissions, --trust-forward-hdrs, etc). I think it's cheap to have several hyper::Servers in the process. Eg, I'd like to run my server in the following configuration:

  1. an http server to go behind my Internet-facing https proxy server. It requires authentication and trusts the X-Real-IP and X-Forwarded-For headers. (I probably should also a header from the proxy with a shared secret to avoid being insecure on accidental misconfiguration.)
  2. http over a trusted Unix-domain socket for conveniently adding users/sessions from the CLI without having to shut down the server (as moonfire-nvr login expects now) or to have already created and stored session cookie.
  3. a http server for use by Prometheus monitoring. I'd like it to be on a separate binding to avoid confusing it with the stuff that should be exposed to the Internet.

Another use: Bobberty just mentioned wanting an IPv4 binding + a IPv6 binding.

Per-bind address knobs might grow to include:

Seems way too awkward to specify all the stuff above on the commandline, and I don't think it belongs well in the database (I don't want to add a configuration tool for it and folks are used to configuration files for stuff like this), so I think we should introduce a config file. toml, text proto, json, yaml, something like that.

scottlamb commented 4 months ago

The crux of this issue is done: there is a config file format with a [[binds]] section now that supports customizing some things. Not all the specific ideas mentioned here are implemented but I think the missing things are covered by other issues.

scottlamb commented 2 weeks ago

Oops, mentioned the wrong issue in that commit. Reopening this one.