dependency cleanup, documentation
This commit is contained in:
@@ -16,11 +16,9 @@ actix-web-static-files = "3.0"
|
||||
[dependencies]
|
||||
actix-identity = "0.3"
|
||||
actix-rt = "1.1"
|
||||
actix-slog = "0.2"
|
||||
actix-web = "3"
|
||||
actix-web-static-files = "3"
|
||||
actix-files = "0.5"
|
||||
anyhow = "1.0"
|
||||
argonautica = "0.2"
|
||||
clap = "2.33"
|
||||
dotenv = "0.15.0"
|
||||
@@ -34,7 +32,6 @@ rpassword = "5.0"
|
||||
serde = "1.0"
|
||||
thiserror = "1.0"
|
||||
tracing-actix-web = "0.2.1"
|
||||
tracing-bunyan-formatter = "0.2.0"
|
||||
tracing-opentelemetry = "0.12"
|
||||
async-trait = "0.1"
|
||||
enum-map = {version="1", features = ["serde"]}
|
||||
|
||||
@@ -18,6 +18,7 @@ use thiserror::Error;
|
||||
use tracing::{error, info, trace};
|
||||
use tracing_actix_web::TracingLogger;
|
||||
|
||||
/// The Error type that is returned by most function calls if anything failed.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ServerError {
|
||||
#[error("Failed to encrypt the password {0} - aborting!")]
|
||||
@@ -42,6 +43,7 @@ impl From<argonautica::Error> for ServerError {
|
||||
}
|
||||
}
|
||||
|
||||
/// Any error can be rendered to a html string.
|
||||
impl ServerError {
|
||||
fn render_error(title: &str, content: &str) -> String {
|
||||
format!(
|
||||
@@ -68,6 +70,7 @@ impl ServerError {
|
||||
}
|
||||
}
|
||||
|
||||
/// Make the error type work nicely with the actix server.
|
||||
impl actix_web::error::ResponseError for ServerError {
|
||||
fn error_response(&self) -> HttpResponse {
|
||||
match self {
|
||||
@@ -119,6 +122,7 @@ impl actix_web::error::ResponseError for ServerError {
|
||||
}
|
||||
}
|
||||
|
||||
/// The qr-code can contain two different protocolls
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Protocol {
|
||||
Http,
|
||||
@@ -146,6 +150,7 @@ impl FromStr for Protocol {
|
||||
}
|
||||
}
|
||||
|
||||
/// The configuration of the server. It is accessible by the views and other parts of the program. Globally valid settings should be stored here.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ServerConfig {
|
||||
pub secret: Secret,
|
||||
@@ -159,6 +164,7 @@ pub struct ServerConfig {
|
||||
pub brand_name: String,
|
||||
}
|
||||
|
||||
/// The configuration can be serialized into an environment-file.
|
||||
impl ServerConfig {
|
||||
#[must_use]
|
||||
pub fn to_env_strings(&self) -> Vec<String> {
|
||||
@@ -186,6 +192,7 @@ impl ServerConfig {
|
||||
}
|
||||
}
|
||||
|
||||
// include the static files into the binary
|
||||
include!(concat!(env!("OUT_DIR"), "/generated.rs"));
|
||||
|
||||
static_loader! {
|
||||
|
||||
Reference in New Issue
Block a user