aboutsummaryrefslogtreecommitdiffstats
path: root/rs/server
diff options
context:
space:
mode:
Diffstat (limited to 'rs/server')
-rw-r--r--rs/server/src/main.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/rs/server/src/main.rs b/rs/server/src/main.rs
index 880cb46..76e447d 100644
--- a/rs/server/src/main.rs
+++ b/rs/server/src/main.rs
@@ -116,7 +116,8 @@ struct Env {
116} 116}
117 117
118fn require_env(name: &str) -> Result<String, String> { 118fn require_env(name: &str) -> Result<String, String> {
119 std::env::var(name).map_err(|_| format!("environment variable {name} should be defined and valid")) 119 std::env::var(name)
120 .map_err(|_| format!("environment variable {name} should be defined and valid"))
120} 121}
121 122
122impl Env { 123impl Env {
@@ -130,7 +131,8 @@ impl Env {
130 key_path: require_env("GITOLFS3_KEY_PATH")?, 131 key_path: require_env("GITOLFS3_KEY_PATH")?,
131 listen_host: require_env("GITOLFS3_LISTEN_HOST")?, 132 listen_host: require_env("GITOLFS3_LISTEN_HOST")?,
132 listen_port: require_env("GITOLFS3_LISTEN_PORT")?, 133 listen_port: require_env("GITOLFS3_LISTEN_PORT")?,
133 trusted_forwarded_hosts: std::env::var("GITOLFS3_TRUSTED_FORWARDED_HOSTS").unwrap_or_default(), 134 trusted_forwarded_hosts: std::env::var("GITOLFS3_TRUSTED_FORWARDED_HOSTS")
135 .unwrap_or_default(),
134 }) 136 })
135 } 137 }
136} 138}
@@ -170,7 +172,7 @@ async fn main() -> ExitCode {
170 Err(e) => { 172 Err(e) => {
171 println!("Failed to create S3 client: {e}"); 173 println!("Failed to create S3 client: {e}");
172 return ExitCode::FAILURE; 174 return ExitCode::FAILURE;
173 }, 175 }
174 }; 176 };
175 let key = match common::load_key(&env.key_path) { 177 let key = match common::load_key(&env.key_path) {
176 Ok(key) => key, 178 Ok(key) => key,
@@ -180,7 +182,8 @@ async fn main() -> ExitCode {
180 } 182 }
181 }; 183 };
182 184
183 let trusted_forwarded_hosts: HashSet<String> = env.trusted_forwarded_hosts 185 let trusted_forwarded_hosts: HashSet<String> = env
186 .trusted_forwarded_hosts
184 .split(',') 187 .split(',')
185 .map(|s| s.to_owned()) 188 .map(|s| s.to_owned())
186 .filter(|s| !s.is_empty()) 189 .filter(|s| !s.is_empty())