mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Sai Harsha Vardhan <56996463+sai-harsha-vardhan@users.noreply.github.com> Co-authored-by: Sahkal Poddar <sahkalplanet@gmail.com> Co-authored-by: Amisha Prabhat <55580080+Aprabhat19@users.noreply.github.com> Co-authored-by: Sarthak Soni <76486416+Sarthak1799@users.noreply.github.com> Co-authored-by: shashank_attarde <shashank.attarde@juspay.in> Co-authored-by: Aprabhat19 <amishaprabhat@gmail.com> Co-authored-by: sai-harsha-vardhan <harsha111hero@gmail.com> Co-authored-by: Sahkal Poddar <sahkal.poddar@juspay.in> Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
41 lines
1.2 KiB
Rust
41 lines
1.2 KiB
Rust
use router::{
|
|
configs::settings::{CmdLineConf, Settings},
|
|
core::errors::{ApplicationError, ApplicationResult},
|
|
logger,
|
|
};
|
|
|
|
#[tokio::main]
|
|
async fn main() -> ApplicationResult<()> {
|
|
// get commandline config before initializing config
|
|
let cmd_line = <CmdLineConf as clap::Parser>::parse();
|
|
|
|
#[allow(clippy::expect_used)]
|
|
let conf = Settings::with_config_path(cmd_line.config_path)
|
|
.expect("Unable to construct application configuration");
|
|
#[allow(clippy::expect_used)]
|
|
conf.validate()
|
|
.expect("Failed to validate router configuration");
|
|
|
|
#[cfg(feature = "vergen")]
|
|
println!("Starting router (Version: {})", router_env::git_tag!());
|
|
|
|
let _guard = router_env::setup(
|
|
&conf.log,
|
|
router_env::service_name!(),
|
|
[router_env::service_name!(), "actix_server"],
|
|
);
|
|
|
|
logger::info!("Application started [{:?}] [{:?}]", conf.server, conf.log);
|
|
|
|
#[allow(clippy::expect_used)]
|
|
let server = Box::pin(router::start_server(conf))
|
|
.await
|
|
.expect("Failed to create the server");
|
|
let _ = server.await;
|
|
|
|
Err(ApplicationError::from(std::io::Error::new(
|
|
std::io::ErrorKind::Other,
|
|
"Server shut down",
|
|
)))
|
|
}
|