diff options
| author | Alexander_Kabui <alexanderkabua@gmail.com> | 2026-10-04 11:07:18 +0300 |
|---|---|---|
| committer | Alexander_Kabui <alexanderkabua@gmail.com> | 2026-10-05 21:52:49 +0300 |
| commit | 9965ccaf9a299aed2f160989004e8a55bf00b06e (patch) | |
| tree | 82250b3bd2c026af557148ee3a25efbb630d9344 /src | |
| parent | c960586ef238089a2b4722ce32b12497e8b77bb9 (diff) | |
| download | genenetwork4-9965ccaf9a299aed2f160989004e8a55bf00b06e.tar.gz | |
* src/config.rs (Config): add GN3_URL layered config key
Base URL of the GeneNetwork3 API for proxy endpoints (phase A search), following the existing layering: built-in default (http://127.0.0.1:5003/api/), overridable via GN4_CONF/GN4_SECRETS files and the GN3_URL environment.
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs index e8313a3..a6fc464 100644 --- a/src/config.rs +++ b/src/config.rs @@ -17,6 +17,9 @@ pub struct Config { /// mysql://user:password@host/database. Same SQL_URI config key /// GeneNetwork3 uses, so the two services can share configuration. pub sql_uri: String, + /// Base URL of the GeneNetwork3 API, used by proxy endpoints. + /// Must end with a slash, e.g. http://127.0.0.1:5003/api/. + pub gn3_url: String, /// TCP port to bind. pub port: u16, /// Base URL of the gn-auth server, e.g. "http://127.0.0.1:8081/". @@ -92,6 +95,10 @@ impl Config { "GN_AUTH_DEV_PASSWORD".to_string(), "testpasswd".to_string(), ); + values.insert( + "GN3_URL".to_string(), + "http://127.0.0.1:5003/api/".to_string(), + ); // Layers 2 and 3: config files, in increasing priority. for env_key in ["GN4_CONF", "GN4_SECRETS"] { @@ -113,6 +120,7 @@ impl Config { "GN_AUTH_DEV_CLIENT_SECRET", "GN_AUTH_DEV_USERNAME", "GN_AUTH_DEV_PASSWORD", + "GN3_URL", ] { if let Ok(value) = std::env::var(key) { values.insert(key.to_string(), value); @@ -121,6 +129,7 @@ impl Config { Config { sql_uri: values["SQL_URI"].clone(), + gn3_url: values["GN3_URL"].clone(), port: values["GENENETWORK4_PORT"] .parse() .expect("GENENETWORK4_PORT must be a number"), |
