Browse Source

Update main.rs

pull/5944/head
8codebubble 1 month ago
committed by GitHub
parent
commit
cd117fa082
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 14
      src/main.rs

14
src/main.rs

@ -12,6 +12,10 @@ use mimalloc::MiMalloc;
#[cfg_attr(feature = "enable_mimalloc", global_allocator)]
static GLOBAL: MiMalloc = MiMalloc;
# lambda_web for aws lambda support
use lambda_web::{is_running_on_lambda, launch_rocket_on_lambda, LambdaError};
#[macro_use]
extern crate rocket;
#[macro_use]
@ -68,7 +72,7 @@ use std::sync::{atomic::Ordering, Arc};
pub use util::is_running_in_container;
#[rocket::main]
async fn main() -> Result<(), Error> {
async fn main() -> Result<(), LambdaError> {
parse_args().await;
launch_info();
@ -570,7 +574,7 @@ async fn create_db_pool() -> db::DbPool {
}
}
async fn launch_rocket(pool: db::DbPool, extra_debug: bool) -> Result<(), Error> {
async fn launch_rocket(pool: db::DbPool, extra_debug: bool) -> Result<(), LambdaError> {
let basepath = &CONFIG.domain_path();
let mut config = rocket::Config::from(rocket::Config::figment());
@ -627,7 +631,13 @@ async fn launch_rocket(pool: db::DbPool, extra_debug: bool) -> Result<(), Error>
});
}
// instance.launch().await?;
// Update
if is_running_on_lambda() {
launch_rocket_on_lambda(instance).await?;
} else {
instance.launch().await?;
}
info!("Vaultwarden process exited!");
Ok(())

Loading…
Cancel
Save