chore: add home_path to WebServer config and fix APP_HOME

This commit is contained in:
Jesús Pérez Lorenzo 2021-09-07 18:09:50 +01:00
parent b7733d50e4
commit 952a3fd661
5 changed files with 60 additions and 48 deletions

View file

@ -1,5 +1,6 @@
use std::collections::HashMap;
use std::fs;
use std::path::Path;
use std::sync::Arc;
use thiserror::Error;
use serde::{Deserialize,Serialize};
@ -192,6 +193,12 @@ impl AuthStore {
// }
pub async fn create_enforcer(model_path: &'static str, policy_path: &'static str) -> SharedEnforcer {
if ! Path::new(&model_path).exists() {
panic!("model path: {} not exists",&model_path);
}
if ! Path::new(&policy_path).exists() {
panic!("policy path: {} not exists",&policy_path);
}
// Arc::new(Enforcer::new(super::super::MODEL_PATH, super::super::POLICY_PATH)
Arc::new(Enforcer::new(model_path, policy_path)
.await