diff --git a/src/cli/start.rs b/src/cli/start.rs index eed1f8a5..8cd71618 100644 --- a/src/cli/start.rs +++ b/src/cli/start.rs @@ -3,6 +3,7 @@ use super::log; use crate::cnf::LOGO; use crate::dbs; use crate::err::Error; +use crate::iam; use crate::net; #[tokio::main] @@ -20,6 +21,8 @@ pub async fn init(matches: &clap::ArgMatches) -> Result<(), Error> { println!("{}", LOGO); // Setup the cli options config::init(matches); + // Initiate master auth + iam::init().await?; // Start the kvs server dbs::init().await?; // Start the web server diff --git a/src/iam/mod.rs b/src/iam/mod.rs index 1a73ad62..53fa7179 100644 --- a/src/iam/mod.rs +++ b/src/iam/mod.rs @@ -3,3 +3,20 @@ pub mod signin; pub mod signup; pub mod token; pub mod verify; + +use crate::cli::CF; +use crate::err::Error; + +const LOG: &str = "surrealdb::iam"; + +pub async fn init() -> Result<(), Error> { + // Get local copy of options + let opt = CF.get().unwrap(); + // Log authentication options + match opt.pass { + Some(_) => info!(target: LOG, "Root authentication is enabled"), + None => info!(target: LOG, "Root authentication is disabled"), + }; + // All ok + Ok(()) +}