This commit is contained in:
parent
4416027253
commit
bbc00e7c3b
7 changed files with 30 additions and 13 deletions
24
Cargo.lock
generated
24
Cargo.lock
generated
|
@ -762,11 +762,11 @@ dependencies = [
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log",
|
|
||||||
"pretty_env_logger",
|
"pretty_env_logger",
|
||||||
"serde 1.0.143",
|
"serde 1.0.143",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2081,21 +2081,33 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing"
|
name = "tracing"
|
||||||
version = "0.1.36"
|
version = "0.1.37"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
|
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"log",
|
"log",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
|
"tracing-attributes",
|
||||||
"tracing-core",
|
"tracing-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-core"
|
name = "tracing-attributes"
|
||||||
version = "0.1.29"
|
version = "0.1.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"
|
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-core"
|
||||||
|
version = "0.1.30"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
|
@ -15,7 +15,6 @@ actix-web = "4"
|
||||||
actix-web-httpauth = "0.8.0"
|
actix-web-httpauth = "0.8.0"
|
||||||
futures-util = { version = "0.3.17", default-features = false, features = ["std"] }
|
futures-util = { version = "0.3.17", default-features = false, features = ["std"] }
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
log = "0.4.17"
|
|
||||||
pretty_env_logger = "0.4.0"
|
pretty_env_logger = "0.4.0"
|
||||||
serde = { version = "1", features=["derive"]}
|
serde = { version = "1", features=["derive"]}
|
||||||
actix-web-codegen-const-routes = { version = "0.1.0", tag = "0.1.0", git = "https://github.com/realaravinth/actix-web-codegen-const-routes" }
|
actix-web-codegen-const-routes = { version = "0.1.0", tag = "0.1.0", git = "https://github.com/realaravinth/actix-web-codegen-const-routes" }
|
||||||
|
@ -27,6 +26,7 @@ url = { version = "2.2.2", features = ["serde"]}
|
||||||
serde_json = { version ="1", features = ["raw_value"]}
|
serde_json = { version ="1", features = ["raw_value"]}
|
||||||
sqlx = { version = "0.6.1", features = [ "runtime-actix-rustls", "postgres", "time", "offline", "json"] }
|
sqlx = { version = "0.6.1", features = [ "runtime-actix-rustls", "postgres", "time", "offline", "json"] }
|
||||||
clap = { vesrion = "3.2.20", features = ["derive"]}
|
clap = { vesrion = "3.2.20", features = ["derive"]}
|
||||||
|
tracing = { version = "0.1.37", features = ["log"] }
|
||||||
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|
|
@ -102,6 +102,7 @@ impl From<FormSubmission> for FormSubmissionResp {
|
||||||
path = "API_V1_ROUTES.forms.get_all",
|
path = "API_V1_ROUTES.forms.get_all",
|
||||||
wrap = "HttpAuthentication::bearer(bearerauth)"
|
wrap = "HttpAuthentication::bearer(bearerauth)"
|
||||||
)]
|
)]
|
||||||
|
#[tracing::instrument(name = "Get form submissions", skip(ctx))]
|
||||||
async fn list_all(
|
async fn list_all(
|
||||||
ctx: AppCtx,
|
ctx: AppCtx,
|
||||||
payload: web::Json<Table>,
|
payload: web::Json<Table>,
|
||||||
|
@ -120,6 +121,7 @@ async fn list_all(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_web_codegen_const_routes::post(path = "API_V1_ROUTES.forms.submit")]
|
#[actix_web_codegen_const_routes::post(path = "API_V1_ROUTES.forms.submit")]
|
||||||
|
#[tracing::instrument(name = "Upload form", skip(ctx, payload))]
|
||||||
async fn upload(
|
async fn upload(
|
||||||
ctx: AppCtx,
|
ctx: AppCtx,
|
||||||
query: web::Query<Table>,
|
query: web::Query<Table>,
|
||||||
|
|
|
@ -47,6 +47,7 @@ pub mod routes {
|
||||||
|
|
||||||
/// emits build details of the bninary
|
/// emits build details of the bninary
|
||||||
#[actix_web_codegen_const_routes::get(path = "crate::API_V1_ROUTES.meta.build_details")]
|
#[actix_web_codegen_const_routes::get(path = "crate::API_V1_ROUTES.meta.build_details")]
|
||||||
|
#[tracing::instrument(name = "Get build details", skip(ctx))]
|
||||||
async fn build_details(ctx: AppCtx) -> impl Responder {
|
async fn build_details(ctx: AppCtx) -> impl Responder {
|
||||||
let build = BuildDetails {
|
let build = BuildDetails {
|
||||||
version: VERSION,
|
version: VERSION,
|
||||||
|
@ -64,7 +65,8 @@ pub struct Health {
|
||||||
|
|
||||||
/// checks all components of the system
|
/// checks all components of the system
|
||||||
#[actix_web_codegen_const_routes::get(path = "crate::API_V1_ROUTES.meta.health")]
|
#[actix_web_codegen_const_routes::get(path = "crate::API_V1_ROUTES.meta.health")]
|
||||||
async fn health(ctx: crate::AppCtx) -> impl Responder {
|
#[tracing::instrument(name = "Get system health", skip(ctx))]
|
||||||
|
async fn health(ctx: AppCtx) -> impl Responder {
|
||||||
let mut resp_builder = HealthBuilder::default();
|
let mut resp_builder = HealthBuilder::default();
|
||||||
|
|
||||||
resp_builder.db(ctx.db.ping().await);
|
resp_builder.db(ctx.db.ping().await);
|
||||||
|
|
|
@ -18,6 +18,7 @@ use std::sync::Arc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
use argon2_creds::{Config, ConfigBuilder, PasswordPolicy};
|
use argon2_creds::{Config, ConfigBuilder, PasswordPolicy};
|
||||||
|
use tracing::info;
|
||||||
|
|
||||||
//use crate::errors::ServiceResult;
|
//use crate::errors::ServiceResult;
|
||||||
use crate::db::*;
|
use crate::db::*;
|
||||||
|
@ -54,9 +55,9 @@ impl Ctx {
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
let init = thread::spawn(move || {
|
let init = thread::spawn(move || {
|
||||||
log::info!("Initializing credential manager");
|
info!("Initializing credential manager");
|
||||||
c.init();
|
c.init();
|
||||||
log::info!("Initialized credential manager");
|
info!("Initialized credential manager");
|
||||||
});
|
});
|
||||||
|
|
||||||
//let db = match s.database.database_type {
|
//let db = match s.database.database_type {
|
||||||
|
|
|
@ -20,7 +20,7 @@ use actix_web::http::StatusCode;
|
||||||
use actix_web::web::JsonConfig;
|
use actix_web::web::JsonConfig;
|
||||||
use actix_web::{error::InternalError, middleware, App, HttpServer};
|
use actix_web::{error::InternalError, middleware, App, HttpServer};
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use log::info;
|
use tracing::info;
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ use std::path::Path;
|
||||||
|
|
||||||
use config::{Config, ConfigError, Environment, File};
|
use config::{Config, ConfigError, Environment, File};
|
||||||
use derive_more::Display;
|
use derive_more::Display;
|
||||||
use log::warn;
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
use tracing::warn;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
|
@ -96,7 +96,7 @@ impl Settings {
|
||||||
} else if Path::new(ETC).exists() {
|
} else if Path::new(ETC).exists() {
|
||||||
s.merge(File::with_name(ETC))?;
|
s.merge(File::with_name(ETC))?;
|
||||||
} else {
|
} else {
|
||||||
log::warn!("configuration file not found");
|
warn!("configuration file not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
s.merge(Environment::with_prefix("LPFORMS").separator("_"))?;
|
s.merge(Environment::with_prefix("LPFORMS").separator("_"))?;
|
||||||
|
|
Loading…
Reference in a new issue