This commit is contained in:
2025-11-13 06:42:09 +01:00
parent 957709f79d
commit 57e67f5c51
8 changed files with 22 additions and 7 deletions
+2
View File
@@ -1821,6 +1821,7 @@ export type AppRefObject = {
export type DsqlAppData = {
DSQL_REMOTE_SQL_HOST?: string | null;
DSQL_SU_USER_ID?: string | null;
DSQL_USER_ID?: string | null;
DSQL_HOST_ENV?: string | null;
DSQL_HOST?: string | null;
DSQL_STATIC_HOST?: string | null;
@@ -2302,6 +2303,7 @@ export const EnvKeys = [
"DSQL_MAIL_PASSWORD",
"DSQL_TINY_MCE_API_KEY",
"DSQL_GITHUB_ID",
"DSQL_USER_ID",
"DSQL_GITHUB_SECRET",
"DSQL_GITHUB_WEBHOOK_SECRET",
"DSQL_GITHUB_WEBHOOK_URL",
+8 -2
View File
@@ -1,5 +1,6 @@
import { UserType } from "../types";
import grabDbFullName from "./grab-db-full-name";
import numberfy from "./numberfy";
type Param = {
/**
@@ -8,7 +9,6 @@ type Param = {
dbName?: string;
userId?: string | number;
user?: UserType | null;
nullable?: boolean;
};
/**
@@ -19,7 +19,13 @@ type Param = {
*/
export default function grabDbNames(params?: Param) {
const dbNamePrefix = process.env.DSQL_USER_DB_PREFIX || "datasquirel_user_";
const finalUserId = params?.user?.id || params?.userId;
const finalUserId =
params?.user?.id ||
params?.userId ||
numberfy(process.env.DSQL_USER_ID) ||
numberfy(process.env.DSQL_DB_NAME?.split("_")?.[2]) ||
undefined;
const userDbPrefix = finalUserId
? `${dbNamePrefix}${finalUserId}_`
: undefined;