Compare commits
No commits in common. "6a6a340618af58967941e9de1cf17c1d98045e9b" and "01984c9e98372462c555e7b12bb0de615be6e1db" have entirely different histories.
6a6a340618
...
01984c9e98
2 changed files with 9 additions and 17 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4873,7 +4873,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "upub-web"
|
||||
version = "0.3.0"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"apb",
|
||||
"base64 0.22.1",
|
||||
|
|
24
main.rs
24
main.rs
|
@ -167,27 +167,21 @@ async fn init(args: Args, config: upub::Config) {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
let ctx = upub::Context::new(db, domain, config.clone())
|
||||
.await.expect("failed creating server context");
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
if let Mode::Cli { command } = args.command {
|
||||
cli::run(ctx, command)
|
||||
.await.expect("failed running cli task");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// register signal handler only for long-lasting modes, such as server or worker
|
||||
let (tx, rx) = tokio::sync::watch::channel(false);
|
||||
let signals = Signals::new([SIGTERM, SIGINT]).expect("failed registering signal handler");
|
||||
let handle = signals.handle();
|
||||
let signals_task = tokio::spawn(handle_signals(signals, tx));
|
||||
let stop = CancellationToken(rx);
|
||||
|
||||
let ctx = upub::Context::new(db, domain, config.clone())
|
||||
.await.expect("failed creating server context");
|
||||
|
||||
match args.command {
|
||||
#[cfg(feature = "cli")]
|
||||
Mode::Cli { command } =>
|
||||
cli::run(ctx, command)
|
||||
.await.expect("failed running cli task"),
|
||||
|
||||
#[cfg(feature = "serve")]
|
||||
Mode::Serve { bind } =>
|
||||
routes::serve(ctx, bind, stop)
|
||||
|
@ -209,8 +203,6 @@ async fn init(args: Args, config: upub::Config) {
|
|||
Mode::Config => unreachable!(),
|
||||
#[cfg(feature = "migrate")]
|
||||
Mode::Migrate => unreachable!(),
|
||||
#[cfg(feature = "cli")]
|
||||
Mode::Cli { .. } => unreachable!(),
|
||||
}
|
||||
|
||||
handle.close();
|
||||
|
|
Loading…
Reference in a new issue