feat: add a function to init properly app library

This commit is contained in:
2024-09-16 22:54:02 +02:00
parent 502dc6f77d
commit 2ef527fa64
6 changed files with 63 additions and 9 deletions

View File

@ -2,6 +2,20 @@ use anyhow::Error as AnyError;
use axum::http::{StatusCode, Uri};
use axum::response::{IntoResponse, Response};
use axum::{routing::get, Router};
use thiserror::Error;
use ::utils::config::{load_config, ConfigError};
#[derive(Error, Debug)]
pub enum InitError {
#[error(transparent)]
ConfigError(#[from] ConfigError),
}
pub fn init() -> Result<(), InitError> {
load_config(None)?;
Ok(())
}
pub fn get_router() -> Router {
Router::new()