mod config;
mod error;
mod html;
mod server;
mod wallet;
#[macro_use]
extern crate log;
use crate::config::ConfigOpts;
use crate::server::create_server;
use crate::wallet::setup_wallet;
use ini::Ini;
use structopt::StructOpt;
fn main() {
env_logger::init();
let _ = Ini::load_from_file("config.ini").map(config::load_ini_to_env);
let conf: ConfigOpts = ConfigOpts::from_args();
let wallet = match setup_wallet(&conf) {
Ok(wallet) => wallet,
Err(e) => {
error!("{}", e);
return;
}
};
let host = conf.host.clone();
let port = conf.port.clone().to_string();
let server = create_server(conf, wallet);
server.listen(&host, &port);
}