Compare commits
1 commit
main
...
v0.23.1-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3ea8384d1 |
3 changed files with 5 additions and 2 deletions
|
|
@ -1,2 +1,3 @@
|
||||||
DATABASE_URL=:memory:
|
DATABASE_URL=:memory:
|
||||||
APP_SECRET=8b9acd4456dd5db0a4a3c4f4e1240b2c3ae08bb59690167197425e4a25dd9a69
|
APP_SECRET=8b9acd4456dd5db0a4a3c4f4e1240b2c3ae08bb59690167197425e4a25dd9a69
|
||||||
|
DISABLE_SECURE_COOKIES=true
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ export type AuthMiddlewareContext = MiddlewareContext<MiddlewareOptions, AuthCon
|
||||||
const createBetterAuth = (secret: string) =>
|
const createBetterAuth = (secret: string) =>
|
||||||
betterAuth({
|
betterAuth({
|
||||||
secret,
|
secret,
|
||||||
trustedOrigins: config.trustedOrigins ?? ["*"],
|
trustedOrigins: config.trustedOrigins,
|
||||||
advanced: {
|
advanced: {
|
||||||
cookiePrefix: "zerobyte",
|
cookiePrefix: "zerobyte",
|
||||||
useSecureCookies: false,
|
useSecureCookies: !config.disableSecureCookies,
|
||||||
},
|
},
|
||||||
onAPIError: {
|
onAPIError: {
|
||||||
throw: true,
|
throw: true,
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ const envSchema = type({
|
||||||
APP_VERSION: "string = 'dev'",
|
APP_VERSION: "string = 'dev'",
|
||||||
TRUSTED_ORIGINS: "string?",
|
TRUSTED_ORIGINS: "string?",
|
||||||
DISABLE_RATE_LIMITING: 'string = "false"',
|
DISABLE_RATE_LIMITING: 'string = "false"',
|
||||||
|
DISABLE_SECURE_COOKIES: 'string = "false"',
|
||||||
APP_SECRET: "32 <= string <= 256",
|
APP_SECRET: "32 <= string <= 256",
|
||||||
}).pipe((s) => ({
|
}).pipe((s) => ({
|
||||||
__prod__: s.NODE_ENV === "production",
|
__prod__: s.NODE_ENV === "production",
|
||||||
|
|
@ -46,6 +47,7 @@ const envSchema = type({
|
||||||
appVersion: s.APP_VERSION,
|
appVersion: s.APP_VERSION,
|
||||||
trustedOrigins: s.TRUSTED_ORIGINS?.split(",").map((origin) => origin.trim()),
|
trustedOrigins: s.TRUSTED_ORIGINS?.split(",").map((origin) => origin.trim()),
|
||||||
disableRateLimiting: s.DISABLE_RATE_LIMITING === "true",
|
disableRateLimiting: s.DISABLE_RATE_LIMITING === "true",
|
||||||
|
disableSecureCookies: s.DISABLE_SECURE_COOKIES === "true",
|
||||||
appSecret: s.APP_SECRET,
|
appSecret: s.APP_SECRET,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue