e5afd54ce0
* Basic storage stub * New models for new node status api * Route handling * Mounting new routes * Missing selective commit * Moved network monitor related files to separate package * Starting to see some sqlx action * Schema updates * Log statement upon finished migration * Removed old diesel related imports * Converted mixnode cache initialisation into a fairing * Moved cache related functionalities to separate package Also defined staging there * Created run method for validator cache + removed unwrap * Removed old node-status-api types and left bunch of todo placeholders in their place * Fixed managing validatorcache * Status reports are starting to get constructed * Submitting some dummy results to the database * Removing duplicate code for generating reports * Removed statuses older than 48h * Initial attempt at trying to obtain reports for all active nodes * Removed duplicates from the full report * Grabbing uptime history * Updating historical uptimes of active nodes * Updated sqlx-data.json * Removed all placeholder foomp owner values * Changed Layer serde behaviour for easier usage * Extended validator api config * Initial (seems working !) integration with network monitor * Added database path configuration to config * Using ValidatorCache in NetworkMonitor * Flag indicating whether validator cache has been initialised * Introduced a locla-only route for reward script to perform daily chores * Flag to save config to a file * Moved spawning of receiving future to run method rather than new * Removed arguments that dont make sense to be configured via CLI * Removed dead code from config file * More dead code removal * Added validator API to CI * Corrected manifest-path arguments * Constructing network monitor by passing config * Combined validator API CI with the main CI file * Using query_as for NodeStatus * Checking if historical uptimes were already calculated on particular day * Making id field NOT NULL * More query_as! action * Updated sqlx-data.json * Removed unused chrono feature * Renamed the migration file * Changed default validator endpoint to point to local validator * Removing unnecessary clone * More appropriate naming * Removed dead code * Lock file updates * Updated network monitor address in contract code * Don't stage node status api if network monitor is disabled * cargo fmt * Updated all license notices to SPDX
76 lines
2.0 KiB
Rust
76 lines
2.0 KiB
Rust
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
use clap::{App, ArgMatches};
|
|
|
|
pub mod client;
|
|
pub mod commands;
|
|
pub mod websocket;
|
|
|
|
fn main() {
|
|
dotenv::dotenv().ok();
|
|
setup_logging();
|
|
println!("{}", banner());
|
|
|
|
let arg_matches = App::new("Nym Client")
|
|
.version(env!("CARGO_PKG_VERSION"))
|
|
.author("Nymtech")
|
|
.about("Implementation of the Nym Client")
|
|
.subcommand(commands::init::command_args())
|
|
.subcommand(commands::run::command_args())
|
|
.subcommand(commands::upgrade::command_args())
|
|
.get_matches();
|
|
|
|
execute(arg_matches);
|
|
}
|
|
|
|
fn execute(matches: ArgMatches) {
|
|
match matches.subcommand() {
|
|
("init", Some(m)) => commands::init::execute(m),
|
|
("run", Some(m)) => commands::run::execute(m),
|
|
("upgrade", Some(m)) => commands::upgrade::execute(m),
|
|
_ => println!("{}", usage()),
|
|
}
|
|
}
|
|
|
|
fn usage() -> &'static str {
|
|
"usage: --help to see available options.\n\n"
|
|
}
|
|
|
|
fn banner() -> String {
|
|
format!(
|
|
r#"
|
|
|
|
_ __ _ _ _ __ ___
|
|
| '_ \| | | | '_ \ _ \
|
|
| | | | |_| | | | | | |
|
|
|_| |_|\__, |_| |_| |_|
|
|
|___/
|
|
|
|
(client - version {:})
|
|
|
|
"#,
|
|
env!("CARGO_PKG_VERSION")
|
|
)
|
|
}
|
|
|
|
fn setup_logging() {
|
|
let mut log_builder = pretty_env_logger::formatted_timed_builder();
|
|
if let Ok(s) = ::std::env::var("RUST_LOG") {
|
|
log_builder.parse_filters(&s);
|
|
} else {
|
|
// default to 'Info'
|
|
log_builder.filter(None, log::LevelFilter::Info);
|
|
}
|
|
|
|
log_builder
|
|
.filter_module("hyper", log::LevelFilter::Warn)
|
|
.filter_module("tokio_reactor", log::LevelFilter::Warn)
|
|
.filter_module("reqwest", log::LevelFilter::Warn)
|
|
.filter_module("mio", log::LevelFilter::Warn)
|
|
.filter_module("want", log::LevelFilter::Warn)
|
|
.filter_module("tungstenite", log::LevelFilter::Warn)
|
|
.filter_module("tokio_tungstenite", log::LevelFilter::Warn)
|
|
.init();
|
|
}
|