Log a message on startup with root authentication info

Closes #11
This commit is contained in:
Tobie Morgan Hitchcock 2022-07-24 01:14:35 +01:00
parent 960a5a768b
commit 7777e3bccd
2 changed files with 20 additions and 0 deletions

View file

@ -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

View file

@ -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(())
}