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
-1
View File
@@ -6,7 +6,6 @@ type Param = {
dbName?: string;
userId?: string | number;
user?: UserType | null;
nullable?: boolean;
};
/**
* # Grab full database name
+7 -2
View File
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = grabDbNames;
const grab_db_full_name_1 = __importDefault(require("./grab-db-full-name"));
const numberfy_1 = __importDefault(require("./numberfy"));
/**
* # Grab full database name
* @description Grab full database name from slug or full name
@@ -12,9 +13,13 @@ const grab_db_full_name_1 = __importDefault(require("./grab-db-full-name"));
* @returns
*/
function grabDbNames(params) {
var _a;
var _a, _b, _c;
const dbNamePrefix = process.env.DSQL_USER_DB_PREFIX || "datasquirel_user_";
const finalUserId = ((_a = params === null || params === void 0 ? void 0 : params.user) === null || _a === void 0 ? void 0 : _a.id) || (params === null || params === void 0 ? void 0 : params.userId);
const finalUserId = ((_a = params === null || params === void 0 ? void 0 : params.user) === null || _a === void 0 ? void 0 : _a.id) ||
(params === null || params === void 0 ? void 0 : params.userId) ||
(0, numberfy_1.default)(process.env.DSQL_USER_ID) ||
(0, numberfy_1.default)((_c = (_b = process.env.DSQL_DB_NAME) === null || _b === void 0 ? void 0 : _b.split("_")) === null || _c === void 0 ? void 0 : _c[2]) ||
undefined;
const userDbPrefix = finalUserId
? `${dbNamePrefix}${finalUserId}_`
: undefined;
+1
View File
@@ -47,6 +47,7 @@ export default function parseEnv(
DSQL_MAIL_PASSWORD: string | undefined;
DSQL_TINY_MCE_API_KEY: string | undefined;
DSQL_GITHUB_ID: string | undefined;
DSQL_USER_ID: string | undefined;
DSQL_GITHUB_SECRET: string | undefined;
DSQL_GITHUB_WEBHOOK_SECRET: string | undefined;
DSQL_GITHUB_WEBHOOK_URL: string | undefined;