about summary refs log tree commit diff
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index ff0ab8c..b23d39b 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -76,6 +76,11 @@ pub struct Config {
     /// Same GEMMA_WRAPPER_CMD config key GeneNetwork3 uses. Defaults to
     /// "gemma-wrapper", resolved via PATH.
     pub gemma_wrapper_cmd: String,
+    /// Where the short (`gn4ai_`) API tokens live: one SQLite database,
+    /// `GN4_API_TOKENS_DB`, default `tokens.sqlite` in the working
+    /// directory. See src/tokens.rs. The file is chmod 0600 on open --
+    /// it is a secret store, and it must not be in the repository.
+    pub api_tokens_db: String,
     /// Directory gemma-wrapper uses to cache K matrices and association
     /// results between calls (its own --cache-dir switch). Defaults to
     /// a "gn4-gemma" directory under the system temp dir.
@@ -274,6 +279,7 @@ impl Config {
         );
         values.insert("XAPIAN_DB_PATH".to_string(), String::new());
         values.insert("SEARCH_ENGINE".to_string(), "forward".to_string());
+        values.insert("GN4_API_TOKENS_DB".to_string(), "tokens.sqlite".to_string());
         values.insert("GEMMA_WRAPPER_CMD".to_string(), "gemma-wrapper".to_string());
         values.insert(
             "GEMMA_CACHE_DIR".to_string(),
@@ -443,6 +449,7 @@ impl Config {
             "GEMMA_PLOTTER",
             "XAPIAN_DB_PATH",
             "SEARCH_ENGINE",
+            "GN4_API_TOKENS_DB",
             "GEMMA_WRAPPER_CMD",
             "GEMMA_CACHE_DIR",
             "RAVANAN_CMD",
@@ -507,6 +514,7 @@ impl Config {
             dev_token_client_secret: values["GN_AUTH_DEV_CLIENT_SECRET"].clone(),
             dev_token_username: values["GN_AUTH_DEV_USERNAME"].clone(),
             dev_token_password: values["GN_AUTH_DEV_PASSWORD"].clone(),
+            api_tokens_db: values["GN4_API_TOKENS_DB"].clone(),
             gemma_wrapper_cmd: values["GEMMA_WRAPPER_CMD"].clone(),
             gemma_cache_dir: values["GEMMA_CACHE_DIR"].clone(),
             ravanan_cmd: values["RAVANAN_CMD"].clone(),
@@ -768,6 +776,7 @@ mod tests {
             "GN3_TIMEOUT_SECS",
             "XAPIAN_DB_PATH",
             "SEARCH_ENGINE",
+            "GN4_API_TOKENS_DB",
             "GEMMA_WRAPPER_CMD",
             "GEMMA_CACHE_DIR",
             "RAVANAN_CMD",