diff options
author | notgne2 | 2020-09-28 15:45:53 -0700 |
---|---|---|
committer | notgne2 | 2020-09-28 15:45:53 -0700 |
commit | 239d0f8999b47e9e76589ee1fa2d9f3459c47335 (patch) | |
tree | d9fa64da2385dcb3cf254a92e00fa92d2431c155 /src/activate.rs | |
parent | a22063343e54da9f589c7235f2f64b57fe5c257b (diff) |
use separate binary for activation, more cleanup
Diffstat (limited to '')
-rw-r--r-- | src/activate.rs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/activate.rs b/src/activate.rs new file mode 100644 index 0000000..c446ee0 --- /dev/null +++ b/src/activate.rs @@ -0,0 +1,54 @@ +use clap::Clap; + +extern crate pretty_env_logger; +#[macro_use] +extern crate log; + +#[macro_use] +extern crate serde_derive; + +#[macro_use] +mod utils; + +/// Activation portion of the simple Rust Nix deploy tool +#[derive(Clap, Debug)] +#[clap(version = "1.0", author = "notgne2 <gen2@gen2.space>")] +struct Opts { + profile_path: String, + closure: String, + + /// Command for activating the given profile + #[clap(long)] + activate_cmd: Option<String>, + + /// Command for bootstrapping + #[clap(long)] + bootstrap_cmd: Option<String>, + + /// Auto rollback if failure + #[clap(long)] + auto_rollback: bool, +} + + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + if std::env::var("DEPLOY_LOG").is_err() { + std::env::set_var("DEPLOY_LOG", "info"); + } + + pretty_env_logger::init_custom_env("DEPLOY_LOG"); + + let opts: Opts = Opts::parse(); + + utils::activate::activate( + opts.profile_path, + opts.closure, + opts.activate_cmd, + opts.bootstrap_cmd, + opts.auto_rollback, + ) + .await?; + + Ok(()) +}
\ No newline at end of file |