Log config path

This commit is contained in:
Andras Schmelczer 2024-12-08 15:01:09 +00:00
parent 3c24ad83e1
commit 46adcd9345
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C

View file

@ -2,7 +2,7 @@ use std::path::Path;
use anyhow::{Context, Result};
use database_config::DatabaseConfig;
use log::warn;
use log::{info, warn};
use serde::{Deserialize, Serialize};
use server_config::ServerConfig;
use tokio::fs;
@ -25,10 +25,10 @@ pub struct Config {
impl Config {
pub async fn read(path: &Path) -> Result<Self> {
if path.exists() {
info!("Loading configuration from {path:?}");
Self::load_from_file(path).await
} else {
warn!("Configuration file not found, writing default configuration to {path:?}");
let config = Config::default();
config.write(path).await?;
Ok(config)