chiark / gitweb /
config: Provide a startup hook
[hippotat.git] / src / bin / server.rs
1 // Copyright 2021 Ian Jackson and contributors to Hippotat
2 // SPDX-License-Identifier: GPL-3.0-or-later
3 // There is NO WARRANTY.
4
5 use hippotat::prelude::*;
6
7 #[derive(StructOpt,Debug)]
8 pub struct Opts {
9   #[structopt(flatten)]
10   log: LogOpts,
11
12   #[structopt(flatten)]
13   config: config::Opts,
14 }
15
16 #[tokio::main]
17 async fn main() {
18   let opts = Opts::from_args();
19   let (ics,global) = config::startup("hippotatd", LinkEnd::Server,
20                                      &opts.config, &opts.log, |ics|
21   {
22     let global = config::InstanceConfigGlobal::from(&ics);
23     Ok(global)
24   });
25
26   dbg!(ics, global);
27 }