929bf2136f6b12ad81e170c68ec982909c473ba6
chmalee
  Wed Oct 1 16:41:33 2025 -0700
Let auth table name for apiKeys be configued in hg.conf, refs #36428

diff --git src/hg/lib/hubSpaceKeys.c src/hg/lib/hubSpaceKeys.c
index 8cff7ed829f..82a1bef0ac9 100644
--- src/hg/lib/hubSpaceKeys.c
+++ src/hg/lib/hubSpaceKeys.c
@@ -1,25 +1,26 @@
 /* hubSpaceKeys.c was originally generated by the autoSql program, which also 
  * generated hubSpaceKeys.h and hubSpaceKeys.sql.  This module links the database and
  * the RAM representation of objects. */
 
 #include "common.h"
 #include "linefile.h"
 #include "dystring.h"
 #include "jksql.h"
 #include "hubSpaceKeys.h"
 #include "hdb.h"
+#include "hgConfig.h"
 
 
 
 char *hubSpaceKeysCommaSepFieldNames = "userName,apiKey";
 
 void hubSpaceKeysStaticLoad(char **row, struct hubSpaceKeys *ret)
 /* Load a row from hubSpaceKeys table into ret.  The contents of ret will
  * be replaced at the next call to this function. */
 {
 
 ret->userName = row[0];
 ret->apiKey = row[1];
 }
 
 struct hubSpaceKeys *hubSpaceKeysLoad(char **row)
@@ -116,21 +117,22 @@
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->userName);
 if (sep == ',') fputc('"',f);
 fputc(sep,f);
 if (sep == ',') fputc('"',f);
 fprintf(f, "%s", el->apiKey);
 if (sep == ',') fputc('"',f);
 fputc(lastSep,f);
 }
 
 /* -------------------------------- End autoSql Generated Code -------------------------------- */
 
 char *userNameForApiKey(char *apiKey)
 /* Return userName associated with apiKey else NULL */
 {
+char *tableName = cfgOptionDefault("authTableName", AUTH_TABLE_DEFAULT);
 struct sqlConnection *conn = hConnectCentral();
-struct dyString *query = sqlDyStringCreate("select userName from %s where apiKey = '%s'", HUBSPACE_AUTH_TABLE, apiKey);
+struct dyString *query = sqlDyStringCreate("select userName from %s where apiKey = '%s'", tableName, apiKey);
 char *userName = sqlQuickString(conn, dyStringCannibalize(&query));
 hDisconnectCentral(&conn);
 return userName;
 }