Added /ping
endpoint for testing and monitoring
This commit is contained in:
parent
5c78958ec7
commit
df42a755f7
@ -4,7 +4,8 @@ Example `config.extension` file to be created in `etc` sub-directory of working
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
---
|
---
|
||||||
port: 8356
|
bind: <Optional, bind/interface to listen requests on. By default localhost only>
|
||||||
|
port: <Optional port, start service on 7777 by default>
|
||||||
apps:
|
apps:
|
||||||
example-website.tld/optional_domain_path:
|
example-website.tld/optional_domain_path:
|
||||||
AUTH_TOKEN: <a super secret token sent in request>
|
AUTH_TOKEN: <a super secret token sent in request>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Run as `RUST_LOG=debug ./deployment-api-rs`
|
Run as `RUST_LOG=debug ./deployment-api-rs`
|
||||||
*/
|
*/
|
||||||
use actix_web::{App, HttpRequest, HttpResponse, HttpServer, Responder, Result, post, web};
|
use actix_web::{App, HttpRequest, HttpResponse, HttpServer, Responder, Result, get, post, web};
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use log::{debug, error, info, warn};
|
use log::{debug, error, info, warn};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
@ -140,6 +140,11 @@ fn release_deployment_lock(request_id: &str, app_name: &str) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[get("/ping")]
|
||||||
|
async fn ping() -> impl Responder {
|
||||||
|
"\\\\m//"
|
||||||
|
}
|
||||||
|
|
||||||
#[post("/deploy")]
|
#[post("/deploy")]
|
||||||
async fn deploy(
|
async fn deploy(
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
@ -354,7 +359,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
APPS_CONFIG.get_or_init(|| settings.apps);
|
APPS_CONFIG.get_or_init(|| settings.apps);
|
||||||
APPS_DEPLOYMENT_LOCK.get_or_init(|| RwLock::new(HashSet::new()));
|
APPS_DEPLOYMENT_LOCK.get_or_init(|| RwLock::new(HashSet::new()));
|
||||||
|
|
||||||
HttpServer::new(|| App::new().service(deploy))
|
HttpServer::new(|| App::new().service(deploy).service(ping))
|
||||||
.bind((settings.bind.as_str(), settings.port))?
|
.bind((settings.bind.as_str(), settings.port))?
|
||||||
.run()
|
.run()
|
||||||
.await
|
.await
|
||||||
|
Loading…
Reference in New Issue
Block a user