Skip to content

Commit

Permalink
Log a message on startup with root authentication info
Browse files Browse the repository at this point in the history
Closes #11
  • Loading branch information
tobiemh committed Jul 24, 2022
1 parent 960a5a7 commit 7777e3b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cli/start.rs
Expand Up @@ -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]
Expand All @@ -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
Expand Down
17 changes: 17 additions & 0 deletions src/iam/mod.rs
Expand Up @@ -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(())
}

0 comments on commit 7777e3b

Please sign in to comment.