added: feature flags
This commit is contained in:
parent
117cb6bc5e
commit
c70b09baa4
10
Cargo.toml
10
Cargo.toml
@ -6,13 +6,19 @@ edition = "2018"
|
|||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = [ "client", "reload" ]
|
||||||
|
reload = []
|
||||||
|
client = [ "dep:url", "dep:reqwest" ]
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.66"
|
anyhow = "1.0.66"
|
||||||
async-trait = "0.1.59"
|
async-trait = "0.1.59"
|
||||||
axum = { version = "0.6.1", features = ["http2"] }
|
axum = { version = "0.6.1", features = ["http2"] }
|
||||||
axum-extra = { version = "0.4.1", features = ["typed-routing"] }
|
axum-extra = { version = "0.4.1", features = ["typed-routing"] }
|
||||||
clap = { version = "4.0.29", features = ["env", "derive"] }
|
clap = { version = "4.0.29", features = ["env", "derive"] }
|
||||||
reqwest = "0.11.13"
|
reqwest = { version = "0.11.13", optional = true }
|
||||||
serde = { version = "1.0.148", features = ["derive"] }
|
serde = { version = "1.0.148", features = ["derive"] }
|
||||||
ssh-key = { version = "0.5.1", features = ["ed25519", "p256", "p384", "rsa", "signature"] }
|
ssh-key = { version = "0.5.1", features = ["ed25519", "p256", "p384", "rsa", "signature"] }
|
||||||
tokio = { version = "1.22.0", features = ["io-std", "test-util", "tracing", "macros", "fs"] }
|
tokio = { version = "1.22.0", features = ["io-std", "test-util", "tracing", "macros", "fs"] }
|
||||||
@ -20,7 +26,7 @@ tower = { version = "0.4.13", features = ["util"] }
|
|||||||
tower-http = { version = "0.3.4", features = ["map-request-body"] }
|
tower-http = { version = "0.3.4", features = ["map-request-body"] }
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
tracing-subscriber = "0.3.16"
|
tracing-subscriber = "0.3.16"
|
||||||
url = "2.3.1"
|
url = { version = "2.3.1", optional = true }
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
ssh-key = { git = "https://github.com/a-dma/SSH.git", branch = "u2f_signatures" }
|
ssh-key = { git = "https://github.com/a-dma/SSH.git", branch = "u2f_signatures" }
|
||||||
|
@ -21,6 +21,7 @@ use ssh_key::{Certificate, PublicKey};
|
|||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use tower::ServiceBuilder;
|
use tower::ServiceBuilder;
|
||||||
use tower_http::ServiceBuilderExt;
|
use tower_http::ServiceBuilderExt;
|
||||||
|
use tracing::debug;
|
||||||
|
|
||||||
use self::extract::CertificateBody;
|
use self::extract::CertificateBody;
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ pub async fn run(
|
|||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
loop {
|
loop {
|
||||||
tokio::time::sleep(Duration::from_secs(30)).await;
|
tokio::time::sleep(std::time::Duration::from_secs(30)).await;
|
||||||
if let Ok(certs) = read_certs(&state.ca, &state.cert_dir).await {
|
if let Ok(certs) = read_certs(&state.ca, &state.cert_dir).await {
|
||||||
*state.certs.lock().await = certs
|
*state.certs.lock().await = certs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@ -108,7 +109,7 @@ pub async fn run(
|
|||||||
|
|
||||||
// run our app with hyper
|
// run our app with hyper
|
||||||
// `axum::Server` is a re-export of `hyper::Server`
|
// `axum::Server` is a re-export of `hyper::Server`
|
||||||
tracing::debug!("listening on {}", address);
|
debug!("listening on {}", address);
|
||||||
axum::Server::bind(&address)
|
axum::Server::bind(&address)
|
||||||
.serve(app.into_make_service())
|
.serve(app.into_make_service())
|
||||||
.await
|
.await
|
||||||
|
Loading…
x
Reference in New Issue
Block a user