summaryrefslogtreecommitdiff
path: root/angelsharkd/src
diff options
context:
space:
mode:
authorCarpenter, Adam (CORP) <Adam.Carpenter@adp.com>2021-10-12 15:16:22 -0400
committerCarpenter, Adam (CORP) <Adam.Carpenter@adp.com>2021-10-12 15:16:22 -0400
commitfa113296cc4e1e30dd9b523fdafffdedc0f8b9cc (patch)
treec7fa3e422b5fdb300f9110365e3ac3135b18265d /angelsharkd/src
parentd8aa76522cc078b5784c94843be37f2875ad5966 (diff)
downloadaltruistic-angelshark-fa113296cc4e1e30dd9b523fdafffdedc0f8b9cc.tar.xz
altruistic-angelshark-fa113296cc4e1e30dd9b523fdafffdedc0f8b9cc.zip
fix: better error handling on env var origin
Diffstat (limited to 'angelsharkd/src')
-rw-r--r--angelsharkd/src/config.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/angelsharkd/src/config.rs b/angelsharkd/src/config.rs
index b0866be..d7d18d2 100644
--- a/angelsharkd/src/config.rs
+++ b/angelsharkd/src/config.rs
@@ -23,7 +23,13 @@ impl Config {
.unwrap_or_else(|_| Ok(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080)))
.with_context(|| "Failed to parse socket bind address.")?;
- let origin = env::var("ANGELSHARKD_ORIGIN").unwrap_or_default();
+ let origin = if debug_mode {
+ String::new()
+ } else {
+ env::var("ANGELSHARKD_ORIGIN").with_context(|| {
+ "In release mode, CORS origin cannot be blank. Set ANGELSHARKD_ORIGIN"
+ })?
+ };
let logins = if let Ok(path) = env::var("ANGELSHARKD_LOGINS") {
File::open(path)