Skip to content

Commit d60b9f9

Browse files
authored
Added health endpoint (#27)
1 parent 50f6ecf commit d60b9f9

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

conf/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ http {
3333
add_header X-Content-Type-Options "nosniff" always;
3434
add_header Referrer-Policy "no-referrer" always;
3535

36-
location ~ ^/(verification|fileupload|filedownload)/ {
36+
location ~ ^/(health|verification|fileupload|filedownload)/ {
3737
proxy_pass http://backend:8000;
3838
}
3939
}

conf/nginx.dev.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ http {
2929
add_header X-Content-Type-Options "nosniff" always;
3030
add_header Referrer-Policy "no-referrer" always;
3131

32-
location ~ ^/(verification|fileupload|filedownload)/ {
32+
location ~ ^/(health|verification|fileupload|filedownload)/ {
3333
proxy_pass http://backend:8000;
3434
}
3535

cryptify-back-end/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ struct InitResponder {
6969
cryptify_token: CryptifyToken,
7070
}
7171

72+
#[get("/health")]
73+
fn health() -> &'static str {
74+
"OK"
75+
}
7276
#[post("/fileupload/init", data = "<request>")]
7377
async fn upload_init(
7478
config: &State<CryptifyConfig>,
@@ -431,7 +435,7 @@ async fn rocket() -> _ {
431435

432436
rocket
433437
.attach(cors)
434-
.mount("/", routes![upload_init, upload_chunk, upload_finalize,])
438+
.mount("/", routes![health,upload_init, upload_chunk, upload_finalize,])
435439
.mount("/filedownload", FileServer::from(config.data_dir()))
436440
.attach(AdHoc::config::<CryptifyConfig>())
437441
.manage(Store::new())

0 commit comments

Comments
 (0)