add dev resources; plumb GUI_ENV_FILE/API_ENV_FILE/API_DESI_DATA into run targets
This commit is contained in:
+14
-1
@@ -1,5 +1,10 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub struct Config {
|
||||
pub bind_addr: String,
|
||||
/// Path to a DESI data file (JSON) to serve; `None` falls back to the
|
||||
/// built-in placeholder catalogs.
|
||||
pub desi_data: Option<PathBuf>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@@ -7,6 +12,14 @@ impl Config {
|
||||
let bind_addr =
|
||||
std::env::var("API_BIND_ADDR").unwrap_or_else(|_| "0.0.0.0:8080".to_string());
|
||||
|
||||
Ok(Self { bind_addr })
|
||||
let desi_data = std::env::var("API_DESI_DATA")
|
||||
.ok()
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(PathBuf::from);
|
||||
|
||||
Ok(Self {
|
||||
bind_addr,
|
||||
desi_data,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user