diff options
| author | KunoiSayami <[email protected]> | 2021-05-15 21:33:15 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2021-05-15 21:33:15 +0800 |
| commit | 2f051ba28328f57552fd8758bdd8877e2b0d86ef (patch) | |
| tree | d7c9dcedf1e2e22588996bd1bc5817e1304feefc /src/datastructures.rs | |
| parent | 8d68ac0b56fa6be0eb5215f346d513b9a2ef37b8 (diff) | |
feat(core): Add remaining repository protect configure methodv0.4.2
* refactor(test): Move test out from core file
Diffstat (limited to 'src/datastructures.rs')
| -rw-r--r-- | src/datastructures.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/datastructures.rs b/src/datastructures.rs index 2f5230c..83f3bc6 100644 --- a/src/datastructures.rs +++ b/src/datastructures.rs @@ -88,13 +88,13 @@ pub struct Config { /// /// In /etc/cgitrc: /// ```conf - /// cgit-simple-auth-protect=none + /// cgit-simple-auth-full-protect=false /// ``` /// /// In repo.conf /// ```conf /// repo.url=test - /// repo.protected=true + /// repo.protect=true /// ``` /// /// Default behavior is protect all repository @@ -145,7 +145,7 @@ impl Config { "cookie-ttl" => cookie_ttl = value.parse().unwrap_or(DEFAULT_COOKIE_TTL), "database" => database = value, "bypass-root" => bypass_root = value.to_lowercase().eq("true"), - "protect" => protect_all = !value.to_lowercase().eq("none"), + "full-protect" => protect_all = !value.to_lowercase().eq("false"), _ => {} } } @@ -195,10 +195,11 @@ impl Config { continue; } - if key.eq("repo.protect") { - if value.trim().to_lowercase().eq("true") && !current_repo.is_empty() { - protect_repos.push(current_repo.to_string()); - } + if key.eq("repo.protect") + && value.trim().to_lowercase().eq("true") + && !current_repo.is_empty() + { + protect_repos.push(current_repo.to_string()); } if key.eq("include") { @@ -296,7 +297,7 @@ impl TestSuite for Config { cookie_ttl: DEFAULT_COOKIE_TTL, test: true, protect_all: false, - protected_repos: vec!["test".to_string()], + protected_repos: vec!["test".to_string(), "repo".to_string()], } } } |
