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/hgHubConnect/trackHubWizard.c src/hg/hgHubConnect/trackHubWizard.c
index 211120c775e..907100ae063 100644
--- src/hg/hgHubConnect/trackHubWizard.c
+++ src/hg/hgHubConnect/trackHubWizard.c
@@ -219,40 +219,42 @@
 
 // the skeleton HTML:
 webIncludeFile("inc/hgMyData.html");
 webIncludeResourceFile("hgMyData.css");
 
 jsInlineF("\nvar cartDb=\"%s %s\";\n", trackHubSkipHubName(hGenome(database)), database);
 jsInlineF("\nvar tusdEndpoint=\"%s\";\n", cfgOptionDefault("hubSpaceTusdEndpoint", NULL));
 jsInlineF("\nvar fileListEndpoint=\"%shgHubConnect\";\n", hLoginHostCgiBinUrl());
 jsInline("$(document).ready(function() {\nhubCreate.init();\n})");
 puts("</div>");
 }
 
 void revokeApiKey(struct cartJson *cj, struct hash *paramHash)
 /* Remove any api keys for the user */
 {
+char *tableName = cfgOptionDefault("authTableName", AUTH_TABLE_DEFAULT);
 char *userName = getUserName();
 struct sqlConnection *conn = hConnectCentral();
-struct dyString *query = sqlDyStringCreate("delete from %s where userName='%s'", HUBSPACE_AUTH_TABLE, userName);
+struct dyString *query = sqlDyStringCreate("delete from %s where userName='%s'", tableName, userName);
 sqlUpdate(conn, dyStringCannibalize(&query));
 hDisconnectCentral(&conn);
 jsonWriteString(cj->jw, "revoke", "true");
 }
 
 void generateApiKey(struct cartJson *cj, struct hash *paramHash)
-/* Make a random (but not crypto-secure api key for use of hubtools to upload to hubspace */
+/* Make a random (but not crypto-secure) api key for use of hubtools to upload to hubspace */
 {
 char *userName = getUserName();
 if (!userName)
     {
     jsonWriteString(cj->jw, "error", "generateApiKey: not logged in");
     return;
     }
 char *apiKey = makeRandomKey(256); // just needs some arbitrary length
 // save this key to the database for this user, the 'on duplicate' part automatically revokes old keys
 struct sqlConnection *conn = hConnectCentral();
-struct dyString *query = sqlDyStringCreate("insert into %s values ('%s', '%s') on duplicate key update apiKey='%s'", HUBSPACE_AUTH_TABLE, userName, apiKey, apiKey);
+char *tableName = cfgOptionDefault("authTableName", AUTH_TABLE_DEFAULT);
+struct dyString *query = sqlDyStringCreate("insert into %s values ('%s', '%s') on duplicate key update apiKey='%s'", tableName, userName, apiKey, apiKey);
 sqlUpdate(conn, dyStringCannibalize(&query));
 jsonWriteString(cj->jw, "apiKey", apiKey);
 hDisconnectCentral(&conn);
 }