From f6ab54a09cfe776a8e726dd610b86c7bfcaad17f Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Fri, 3 Jul 2020 14:23:09 +0700 Subject: [PATCH] Readme and comment updates --- README.md | 11 ++++++++++- src/main.rs | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index becce0d..393427f 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,16 @@ You can modify this by changing the `bind` and the `bind_port` parameter. Use can enable `rtsps` (TLS) by adding a `certificate = "/path/to/pem"` to the config. This pem should contain by the certificate and the key used for the server. If TLS is enabled all connections must use `rtsps`. You can also control client side TLS with the config option `tls_client_auth = "none|request|require"`, in this case the client should present a certificate signed by the server's CA, this is disabled by default. -Use can enable basic authentication by adding the configuration option `username = "someone"` and `password = "somepass"`. Both username and password must be set for this to work. +Use can enable basic authentication by adding users to the configuration file as: +``` +[[users]] +name: someone +pass: somepass +``` +you also need to add the allowed users into each camera by adding the following to `[[cameras]]`. +``` +permitted_users = ["someone", "someoneelse"] +``` You can change the Neolink log level by setting the `RUST_LOG` environment variable (not in the configuration file) to one of `error`, `warn`, `info`, `debug`, or `trace`: diff --git a/src/main.rs b/src/main.rs index 1922fc5..4761abe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -162,8 +162,8 @@ fn set_up_users(users: &Vec, rtsp: &RtspServer) { fn get_permitted_users(users: &Vec, current_permitted_users: &Vec) -> Vec { // This is required to handle the special case of "anyone" - // Special set up of "anyone" - // If in the camera config there is the user anyone + // ===Special set up of "anyone"=== + // If in the camera config there is the user "anyone" // Then we add all users to the cameras config. including unauth let mut new_permitted_users = vec![]; if current_permitted_users.contains(&"anyone".to_string()) { @@ -176,6 +176,7 @@ fn get_permitted_users(users: &Vec, current_permitted_users: &Vec