add static route for main.css
Some checks failed
Build and publish the docker image / build (push) Failing after 10s

Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
ngn
2025-01-20 05:54:35 +03:00
parent f4dd0995a7
commit 314b237bb7
9 changed files with 19 additions and 21 deletions

View File

@ -20,6 +20,7 @@ use actix_web::{
error::InternalError, http::StatusCode, middleware as actix_middleware, web::JsonConfig, App,
HttpServer,
};
use actix_files as fs;
use lazy_static::lazy_static;
use log::info;
@ -66,6 +67,7 @@ async fn main() -> std::io::Result<()> {
HttpServer::new(move || {
App::new()
.service(fs::Files::new("/static", "./static"))
.wrap(actix_middleware::Logger::default())
.wrap(actix_middleware::Compress::default())
.app_data(get_json_err())

View File

@ -40,16 +40,10 @@ impl Settings {
let mut s = Config::builder();
// setting default values
const CURRENT_DIR: &str = "./config.toml";
const ETC: &str = "/etc/libmedium/config.toml";
if let Ok(path) = env::var("LIBMEDIUM") {
s = s.add_source(File::with_name(&path));
} else if Path::new(CURRENT_DIR).exists() {
// merging default config from file
s = s.add_source(File::with_name(CURRENT_DIR));
} else if Path::new(ETC).exists() {
s = s.add_source(File::with_name(ETC));
} else if Path::new("./config.toml").exists() {
s = s.add_source(File::with_name("./config.toml");
} else {
log::warn!("configuration file not found");
}