Merge pull request #13 from GreenPenguino/command-line-argument
Add command-line argument for control api endpoint
This commit is contained in:
commit
7d61fd1686
@ -3,11 +3,17 @@ use axum::{
|
||||
Router,
|
||||
};
|
||||
use proxima_centauri::{process_command, root, GlobalState};
|
||||
use std::{net::SocketAddr, sync::Arc};
|
||||
use std::sync::Arc;
|
||||
use tracing::Level;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let addr: std::net::SocketAddr = std::env::args()
|
||||
.nth(1)
|
||||
.unwrap_or_else(|| "127.0.0.1:14000".to_string())
|
||||
.parse()
|
||||
.unwrap();
|
||||
|
||||
// initialize tracing
|
||||
let subscriber = tracing_subscriber::FmtSubscriber::builder()
|
||||
.with_max_level(Level::INFO)
|
||||
@ -27,7 +33,6 @@ async fn main() {
|
||||
.with_state(shared_state);
|
||||
|
||||
// run our app with hyper
|
||||
let addr = SocketAddr::from(([127, 0, 0, 1], 14000));
|
||||
tracing::debug!("listening on {}", addr);
|
||||
axum::Server::bind(&addr)
|
||||
.serve(app.into_make_service())
|
||||
|
@ -100,9 +100,7 @@ impl GlobalState {
|
||||
Self {
|
||||
proxies: Mutex::new(HashMap::new()),
|
||||
ports: RwLock::new(HashSet::new()),
|
||||
verifying_key: verifying_key
|
||||
.map(|key| VerifyingKey::from_str(key.as_ref()).ok())
|
||||
.flatten(),
|
||||
verifying_key: verifying_key.and_then(|key| VerifyingKey::from_str(key.as_ref()).ok()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user