1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-07-07 04:54:57 +00:00

Update main.rs

This commit is contained in:
8codebubble 2025-06-10 14:41:26 +09:00 committed by GitHub
parent 91ac0d977b
commit cd117fa082
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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?;
// instance.launch().await?;
// Update
if is_running_on_lambda() {
launch_rocket_on_lambda(instance).await?;
} else {
instance.launch().await?;
}
info!("Vaultwarden process exited!");
Ok(())