This commit is contained in:
2025-11-13 06:16:55 +01:00
parent e6b4b09277
commit 90c36f2345
28 changed files with 145 additions and 75 deletions
-1
View File
@@ -45,7 +45,6 @@ export default async function get<
*
* @description Look for local db settings in `.env` file and by pass the http request if available
*/
const { DSQL_DB_NAME } = process.env;
if (useLocal) {
const result = await dsqlCrud({
-3
View File
@@ -47,9 +47,6 @@ export default async function post({
*
* @description Look for local db settings in `.env` file and by pass the http request if available
*/
const { DSQL_DB_HOST, DSQL_DB_USERNAME, DSQL_DB_PASSWORD, DSQL_DB_NAME } =
process.env;
if (useLocal) {
if (debug) {
debugLog({
@@ -5,6 +5,7 @@ import encrypt from "../../../functions/dsql/encrypt";
import grabHostNames from "../../../utils/grab-host-names";
import apiGithubLogin from "../../../functions/api/users/social/api-github-login";
import grabCookieExpiryDate from "../../../utils/grab-cookie-expirt-date";
import grabDbNames from "../../../utils/grab-db-names";
interface FunctionReturn {
success: boolean;
@@ -23,7 +24,7 @@ type Param = {
key: string;
code: string;
email: string | null;
database: string;
database?: string;
clientId: string;
clientSecret: string;
response: http.ServerResponse;
@@ -96,15 +97,8 @@ export default async function githubAuth({
*
* @description Look for local db settings in `.env` file and by pass the http request if available
*/
const {
DSQL_DB_HOST,
DSQL_DB_USERNAME,
DSQL_DB_PASSWORD,
DSQL_DB_NAME,
DSQL_KEY,
DSQL_REF_DB_NAME,
DSQL_FULL_SYNC,
} = process.env;
const { DSQL_DB_HOST, DSQL_DB_USERNAME, DSQL_DB_PASSWORD, DSQL_DB_NAME } =
process.env;
if (
DSQL_DB_HOST?.match(/./) &&
@@ -126,13 +120,15 @@ export default async function githubAuth({
dbSchema = JSON.parse(fs.readFileSync(localDbSchemaPath, "utf8"));
} catch (error) {}
const { dbFullName } = grabDbNames({ dbName: database });
httpResponse = await apiGithubLogin({
code,
email: email || undefined,
clientId,
clientSecret,
additionalFields,
database: DSQL_DB_NAME,
database: dbFullName,
additionalData,
});
} else {
+2 -3
View File
@@ -7,6 +7,7 @@ import { AuthenticatedUser, DATASQUIREL_LoggedInUser } from "../../types";
import getCsrfHeaderName from "../../actions/get-csrf-header-name";
import grabHostNames from "../../utils/grab-host-names";
import debugLog from "../../utils/logging/debug-log";
import grabDbNames from "../../utils/grab-db-names";
const minuteInMilliseconds = 60000;
const hourInMilliseconds = minuteInMilliseconds * 60;
@@ -24,7 +25,6 @@ type Param = {
encryptionSalt?: string;
level?: "deep" | "normal";
database?: string;
dsqlUserId?: string | number;
expiry?: number;
csrfHeaderName?: string;
debug?: boolean;
@@ -44,7 +44,6 @@ export default function userAuth({
encryptionSalt,
level,
database,
dsqlUserId,
encryptedUserString,
expiry = weekInMilliseconds,
cookieString,
@@ -69,7 +68,7 @@ export default function userAuth({
}
const keyNames = getAuthCookieNames({
database: database || process.env.DSQL_DB_NAME,
database,
});
if (debug) {