-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add healthcheck endpoint and startup check
- Loading branch information
1 parent
e022242
commit e2711cc
Showing
5 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
use actix_web::web; | ||
|
||
use crate::health; | ||
use crate::note; | ||
use crate::status; | ||
|
||
pub fn init(cfg: &mut web::ServiceConfig) { | ||
cfg.service( | ||
web::scope("/api") | ||
.service(note::init()) | ||
.service(status::init()), | ||
.service(status::init()) | ||
.service(health::init()), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod routes; | ||
|
||
pub use routes::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use actix_web::{get, web, HttpResponse, Responder, Scope}; | ||
|
||
use crate::store; | ||
|
||
#[get("/")] | ||
async fn get_live() -> impl Responder { | ||
if store::can_reach_redis() { | ||
return HttpResponse::Ok(); | ||
} else { | ||
return HttpResponse::ServiceUnavailable(); | ||
} | ||
} | ||
|
||
pub fn init() -> Scope { | ||
web::scope("/live").service(get_live) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters