feat: add dotenvy for environment variable management and improve error handling in Env struct

This commit is contained in:
MythEclipse
2025-06-28 20:21:20 +07:00
parent cfa251337f
commit f598dedb3b
9 changed files with 151 additions and 49 deletions
+5 -3
View File
@@ -1,12 +1,14 @@
use imphnen_iam::UsersSchema;
use imphnen_libs::enviroment::load_env;
use imphnen_utils::{get_iso_date, hash_password, Env};
use std::error::Error;
use surrealdb::{engine::remote::ws::Ws, opt::auth::Root, sql::Thing, Surreal};
use surrealdb::{opt::auth::Root, sql::Thing};
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
load_env();
let env = Env::new();
let db = Surreal::new::<Ws>(env.surrealdb_url).await?;
use surrealdb::engine::any;
let db = any::connect(&env.surrealdb_url).await?;
db.signin(Root {
username: &env.surrealdb_username,
password: &env.surrealdb_password,