about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.rs9
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"),