feat: add base_path to settings to specify deploy host name.

DESCRIPTION
    Each deployment should have a default hostname before a custom
    domain can be assigned. Therefore, this domain must be in control of
    the Librepages system (Librepages/conductor, namely)

SECURITY
    base_domain must be different from the domains hosting confidential
    information (authentication systems, PII data, etc.) to make use of
    browser domain sandboxing safety. If Librepages deployment is open
    to the public, unaudited, third-party content may be hosted in this
    domain, so it is very important that this domain shouldn't be used
    for critical infrastructure dealing with confidential information.
This commit is contained in:
Aravinth Manivannan 2022-11-10 17:19:35 +05:30
parent 344cc85935
commit dd38dd05d1
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
2 changed files with 2 additions and 26 deletions

View File

@ -19,8 +19,7 @@ cookie_secret = "94b2b2732626fdb7736229a7c777cb451e6304c147c4549f30"
[page]
base_path = "/tmp/librepages-defualt-config/"
base_domain = "librepages.test" # domain where customer pages will be deployed.
[database]
# This section deals with the database location and how to access it

View File

@ -89,6 +89,7 @@ pub struct Settings {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PageConfig {
pub base_path: String,
pub base_domain: String,
}
#[cfg(not(tarpaulin_include))]
@ -181,31 +182,7 @@ impl Settings {
}
}
// create_dir_util(Path::new(&page.path));
create_dir_util(Path::new(&self.page.base_path));
// for (index, page) in self.pages.iter().enumerate() {
// Url::parse(&page.repo).unwrap();
//
// for (index2, page2) in self.pages.iter().enumerate() {
// if index2 == index {
// continue;
// }
// if page.secret == page2.secret {
// error!("{}", ServiceError::SecretTaken(page.clone(), page2.clone()));
// } else if page.repo == page2.repo {
// error!(
// "{}",
// ServiceError::DuplicateRepositoryURL(page.clone(), page2.clone(),)
// );
// } else if page.path == page2.path {
// error!("{}", ServiceError::PathTaken(page.clone(), page2.clone()));
// }
// }
// if let Err(e) = page.update(&page.branch) {
// error!("{e}");
// }
// }
}
#[cfg(not(tarpaulin_include))]