chore: WebServer in config as vector for Multiples Webs mode
This commit is contained in:
parent
54e67f2c92
commit
8864086ddc
@ -72,7 +72,7 @@ pub async fn config (
|
|||||||
// if prfx.as_str() == "ta" {
|
// if prfx.as_str() == "ta" {
|
||||||
// let cur = db.colls.ta.entries.read();
|
// let cur = db.colls.ta.entries.read();
|
||||||
// }
|
// }
|
||||||
// let allow_origin = reqenv.config().allow_origin;
|
// let allow_origin = reqenv.websrvr().allow_origin;
|
||||||
// let result = cloud_req("config",&cloud,&reqenv,&opts).await;
|
// let result = cloud_req("config",&cloud,&reqenv,&opts).await;
|
||||||
// println!("Result: {}",&result);
|
// println!("Result: {}",&result);
|
||||||
// return Ok(warp::http::Response::builder()
|
// return Ok(warp::http::Response::builder()
|
||||||
@ -199,7 +199,7 @@ pub async fn provision (
|
|||||||
// if prfx.as_str() == "ta" {
|
// if prfx.as_str() == "ta" {
|
||||||
// let cur = db.colls.ta.entries.read();
|
// let cur = db.colls.ta.entries.read();
|
||||||
// }
|
// }
|
||||||
// let allow_origin = reqenv.config().allow_origin;
|
// let allow_origin = reqenv.websrvr().allow_origin;
|
||||||
// let test = true;
|
// let test = true;
|
||||||
// if test == true {
|
// if test == true {
|
||||||
let result = cloud_req("provision",&cloud,&reqenv,&opts).await;
|
let result = cloud_req("provision",&cloud,&reqenv,&opts).await;
|
||||||
@ -329,7 +329,7 @@ pub async fn status (
|
|||||||
// if prfx.as_str() == "ta" {
|
// if prfx.as_str() == "ta" {
|
||||||
// let cur = db.colls.ta.entries.read();
|
// let cur = db.colls.ta.entries.read();
|
||||||
// }
|
// }
|
||||||
// let allow_origin = reqenv.config().allow_origin;
|
// let allow_origin = reqenv.websrvr().allow_origin;
|
||||||
// let result = cloud_req("status",&cloud,&reqenv,&opts).await;
|
// let result = cloud_req("status",&cloud,&reqenv,&opts).await;
|
||||||
// println!("Result: {}",&result);
|
// println!("Result: {}",&result);
|
||||||
// return Ok(warp::http::Response::builder()
|
// return Ok(warp::http::Response::builder()
|
||||||
@ -455,7 +455,7 @@ pub async fn liveness (
|
|||||||
// if prfx.as_str() == "ta" {
|
// if prfx.as_str() == "ta" {
|
||||||
// let cur = db.colls.ta.entries.read();
|
// let cur = db.colls.ta.entries.read();
|
||||||
// }
|
// }
|
||||||
// let allow_origin = reqenv.config().allow_origin;
|
// let allow_origin = reqenv.websrvr().allow_origin;
|
||||||
// let test = true;
|
// let test = true;
|
||||||
// if test == true {
|
// if test == true {
|
||||||
// let result = cloud_req("liveness",&cloud,&reqenv,&opts).await;
|
// let result = cloud_req("liveness",&cloud,&reqenv,&opts).await;
|
||||||
|
@ -57,7 +57,7 @@ pub async fn table(
|
|||||||
let mut ctx = reqenv.ctx();
|
let mut ctx = reqenv.ctx();
|
||||||
let req_context = "";
|
let req_context = "";
|
||||||
let app_ctx: &str;
|
let app_ctx: &str;
|
||||||
if ! req_context.is_empty() && req_context != reqenv.config().default_module.as_str() {
|
if ! req_context.is_empty() && req_context != reqenv.websrvr().default_module.as_str() {
|
||||||
app_ctx = req_context;
|
app_ctx = req_context;
|
||||||
} else {
|
} else {
|
||||||
app_ctx = "";
|
app_ctx = "";
|
||||||
@ -68,7 +68,7 @@ pub async fn table(
|
|||||||
data_hash.insert("lang".to_string(), lang.to_owned());
|
data_hash.insert("lang".to_string(), lang.to_owned());
|
||||||
data_hash.insert("lang_txt".to_string(), lang_items.to_owned());
|
data_hash.insert("lang_txt".to_string(), lang_items.to_owned());
|
||||||
|
|
||||||
// let allow_origin = reqenv.config().allow_origin;
|
// let allow_origin = reqenv.websrvr().allow_origin;
|
||||||
match reqenv.user_authentication().await {
|
match reqenv.user_authentication().await {
|
||||||
Ok(auth) => {
|
Ok(auth) => {
|
||||||
dbg!("auth: {}",&auth);
|
dbg!("auth: {}",&auth);
|
||||||
@ -78,7 +78,7 @@ pub async fn table(
|
|||||||
match reqenv.req
|
match reqenv.req
|
||||||
.render_page(
|
.render_page(
|
||||||
&mut ctx,
|
&mut ctx,
|
||||||
reqenv.config().templates_path.as_str(),
|
reqenv.websrvr().templates_path.as_str(),
|
||||||
"ta_table/index.html",
|
"ta_table/index.html",
|
||||||
"index.html",
|
"index.html",
|
||||||
format!("ta_table/{}.toml", lang.to_owned())
|
format!("ta_table/{}.toml", lang.to_owned())
|
||||||
@ -148,7 +148,7 @@ pub async fn list(
|
|||||||
// if prfx.as_str() == "ta" {
|
// if prfx.as_str() == "ta" {
|
||||||
// let cur = db.colls.ta.entries.read();
|
// let cur = db.colls.ta.entries.read();
|
||||||
// }
|
// }
|
||||||
// let allow_origin = reqenv.config().allow_origin;
|
// let allow_origin = reqenv.websrvr().allow_origin;
|
||||||
match reqenv.user_authentication().await {
|
match reqenv.user_authentication().await {
|
||||||
Ok(_auth) => {
|
Ok(_auth) => {
|
||||||
// dbg!("auth: {}",&auth);
|
// dbg!("auth: {}",&auth);
|
||||||
|
@ -58,7 +58,7 @@ pub async fn langs(
|
|||||||
// }
|
// }
|
||||||
// log::debug!("LANG: {} - {}",language, lang);
|
// log::debug!("LANG: {} - {}",language, lang);
|
||||||
// dbg!("LANG: {} - {}",language, lang);
|
// dbg!("LANG: {} - {}",language, lang);
|
||||||
// let allow_origin = reqenv.config().allow_origin;
|
// let allow_origin = reqenv.websrvr().allow_origin;
|
||||||
|
|
||||||
match reqenv.user_authentication().await {
|
match reqenv.user_authentication().await {
|
||||||
Ok(_auth) => {
|
Ok(_auth) => {
|
||||||
@ -105,7 +105,7 @@ pub async fn defs(
|
|||||||
// path: warp::path::FullPath, headers: warp::http::HeaderMap
|
// path: warp::path::FullPath, headers: warp::http::HeaderMap
|
||||||
) -> Result<impl Reply, Rejection> {
|
) -> Result<impl Reply, Rejection> {
|
||||||
let reqenv = ReqEnv::new(db.app, db.auth, header, method, "/defs", "defs", &prfx);
|
let reqenv = ReqEnv::new(db.app, db.auth, header, method, "/defs", "defs", &prfx);
|
||||||
// let allow_origin = reqenv.config().allow_origin;
|
// let allow_origin = reqenv.websrvr().allow_origin;
|
||||||
match reqenv.user_authentication().await {
|
match reqenv.user_authentication().await {
|
||||||
Ok(auth) => {
|
Ok(auth) => {
|
||||||
// dbg!("auth: {}",&auth);
|
// dbg!("auth: {}",&auth);
|
||||||
@ -118,9 +118,9 @@ pub async fn defs(
|
|||||||
// log::debug!("LANG: {} - {}",language, lang);
|
// log::debug!("LANG: {} - {}",language, lang);
|
||||||
// dbg!("LANG: {} - {}",language, lang);
|
// dbg!("LANG: {} - {}",language, lang);
|
||||||
|
|
||||||
let mut path = format!("{}/profiles/{}/{}/defs.yaml",reqenv.config().resources_path,&prfx,&auth.user_id);
|
let mut path = format!("{}/profiles/{}/{}/defs.yaml",reqenv.websrvr().resources_path,&prfx,&auth.user_id);
|
||||||
if ! std::path::Path::new(&path).exists() {
|
if ! std::path::Path::new(&path).exists() {
|
||||||
path = format!("{}/profiles/{}/defs.yaml",reqenv.config().resources_path,&prfx);
|
path = format!("{}/profiles/{}/defs.yaml",reqenv.websrvr().resources_path,&prfx);
|
||||||
}
|
}
|
||||||
let content = Profile::load_fs_content(path.into());
|
let content = Profile::load_fs_content(path.into());
|
||||||
// let lang = opts.lang.unwrap_or_else(|| String::from("es"));
|
// let lang = opts.lang.unwrap_or_else(|| String::from("es"));
|
||||||
|
Loading…
Reference in New Issue
Block a user