feat(auth): introduce BETTER_AUTH_SECRET for better authentication handling

- Added BETTER_AUTH_SECRET constant to manage authentication secret, defaulting to a predefined value if not set in the environment.
- Updated betterAuth configuration to utilize BETTER_AUTH_SECRET for enhanced security in authentication processes.
This commit is contained in:
Mauricio Siu
2026-02-05 09:46:30 -06:00
parent ca7d3f8cb3
commit 82158ed34d
2 changed files with 6 additions and 1 deletions

View File

@@ -4,6 +4,10 @@ import Docker from "dockerode";
export const IS_CLOUD = process.env.IS_CLOUD === "true";
export const docker = new Docker();
export const BETTER_AUTH_SECRET =
process.env.BETTER_AUTH_SECRET ||
"RXu/xoLHaA1Xgs+R8a0LjVjCVOEnWISQWxw7nXxlvKo=";
export const paths = (isServer = false) => {
const BASE_PATH =
isServer || process.env.NODE_ENV === "production"

View File

@@ -6,7 +6,7 @@ import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { APIError } from "better-auth/api";
import { admin, apiKey, organization, twoFactor } from "better-auth/plugins";
import { and, desc, eq } from "drizzle-orm";
import { IS_CLOUD } from "../constants";
import { BETTER_AUTH_SECRET, IS_CLOUD } from "../constants";
import { db } from "../db";
import * as schema from "../db/schema";
import { getTrustedOrigins, getUserByToken } from "../services/admin";
@@ -29,6 +29,7 @@ const { handler, api } = betterAuth({
"/organization/update",
"/organization/delete",
],
secret: BETTER_AUTH_SECRET,
appName: "Dokploy",
socialProviders: {
github: {