Log config path
This commit is contained in:
parent
3c24ad83e1
commit
46adcd9345
1 changed files with 2 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ use std::path::Path;
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use database_config::DatabaseConfig;
|
use database_config::DatabaseConfig;
|
||||||
use log::warn;
|
use log::{info, warn};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use server_config::ServerConfig;
|
use server_config::ServerConfig;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
@ -25,10 +25,10 @@ pub struct Config {
|
||||||
impl Config {
|
impl Config {
|
||||||
pub async fn read(path: &Path) -> Result<Self> {
|
pub async fn read(path: &Path) -> Result<Self> {
|
||||||
if path.exists() {
|
if path.exists() {
|
||||||
|
info!("Loading configuration from {path:?}");
|
||||||
Self::load_from_file(path).await
|
Self::load_from_file(path).await
|
||||||
} else {
|
} else {
|
||||||
warn!("Configuration file not found, writing default configuration to {path:?}");
|
warn!("Configuration file not found, writing default configuration to {path:?}");
|
||||||
|
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
config.write(path).await?;
|
config.write(path).await?;
|
||||||
Ok(config)
|
Ok(config)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue