mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2025-09-05 17:00:39 +00:00
add healthcheck endpoint and startup check
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
use actix_web::{
|
||||
middleware::{self, Logger},
|
||||
web, App, HttpServer,
|
||||
web::{self},
|
||||
App, HttpServer,
|
||||
};
|
||||
use dotenv::dotenv;
|
||||
use log::error;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
@@ -10,6 +12,7 @@ extern crate lazy_static;
|
||||
mod api;
|
||||
mod client;
|
||||
mod config;
|
||||
mod health;
|
||||
mod note;
|
||||
mod size;
|
||||
mod status;
|
||||
@@ -20,6 +23,11 @@ async fn main() -> std::io::Result<()> {
|
||||
dotenv().ok();
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or(config::VERBOSITY.as_str()));
|
||||
|
||||
if !store::can_reach_redis() {
|
||||
error!("cannot reach redis");
|
||||
panic!("canont reach redis");
|
||||
}
|
||||
|
||||
return HttpServer::new(|| {
|
||||
App::new()
|
||||
.wrap(Logger::new("\"%r\" %s %b %T"))
|
||||
|
Reference in New Issue
Block a user