mirror of
https://github.com/rybbit-io/rybbit.git
synced 2025-05-10 20:05:38 +02:00
Refactor authentication and environment configuration
- Removed the .env.example file as it is no longer needed. - Added DISABLE_SIGNUP environment variable to docker-compose files for cloud and development environments. - Updated setup script to include DISABLE_SIGNUP with a default value of false. - Modified auth.ts to utilize DISABLE_SIGNUP for controlling signup functionality. - Introduced DISABLE_SIGNUP constant in const.ts to manage its value from environment variables.
This commit is contained in:
parent
990861aca6
commit
1d0ffdf9d9
7 changed files with 8 additions and 6 deletions
|
@ -1,2 +0,0 @@
|
|||
BASE_URL=[your-base-url]
|
||||
BETTER_AUTH_SECRET=[your-better-auth-secret]
|
|
@ -68,6 +68,7 @@ services:
|
|||
- POSTGRES_PASSWORD=frog
|
||||
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
|
||||
- BASE_URL=${BASE_URL}
|
||||
- DISABLE_SIGNUP=${DISABLE_SIGNUP}
|
||||
# below is only for rybbit cloud
|
||||
- CLOUD=${CLOUD}
|
||||
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
|
||||
|
|
|
@ -70,8 +70,7 @@ services:
|
|||
- POSTGRES_PASSWORD=frog
|
||||
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
|
||||
- BASE_URL=${BASE_URL}
|
||||
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
|
||||
- STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
|
||||
- DISABLE_SIGNUP=${DISABLE_SIGNUP}
|
||||
# below is only for rybbit cloud
|
||||
- CLOUD=${CLOUD}
|
||||
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
|
||||
|
|
|
@ -68,6 +68,7 @@ services:
|
|||
- POSTGRES_PASSWORD=frog
|
||||
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
|
||||
- BASE_URL=${BASE_URL}
|
||||
- DISABLE_SIGNUP=${DISABLE_SIGNUP}
|
||||
depends_on:
|
||||
clickhouse:
|
||||
condition: service_healthy
|
||||
|
|
|
@ -6,7 +6,7 @@ import { eq } from "drizzle-orm";
|
|||
import pg from "pg";
|
||||
import { db } from "../db/postgres/postgres.js";
|
||||
import * as schema from "../db/postgres/schema.js";
|
||||
import { IS_CLOUD } from "./const.js";
|
||||
import { DISABLE_SIGNUP } from "./const.js";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
|
@ -33,6 +33,7 @@ export let auth: AuthType | null = betterAuth({
|
|||
}),
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
disableSignUp: DISABLE_SIGNUP,
|
||||
},
|
||||
socialProviders: {
|
||||
google: {
|
||||
|
@ -87,8 +88,8 @@ export function initAuth(allowedOrigins: string[]) {
|
|||
enabled: true,
|
||||
// Disable email verification for now
|
||||
requireEmailVerification: false,
|
||||
disableSignUp: DISABLE_SIGNUP,
|
||||
},
|
||||
|
||||
socialProviders: {
|
||||
google: {
|
||||
clientId: process.env.GOOGLE_CLIENT_ID!,
|
||||
|
|
|
@ -3,6 +3,7 @@ import dotenv from "dotenv";
|
|||
dotenv.config();
|
||||
|
||||
export const IS_CLOUD = process.env.CLOUD === "true";
|
||||
export const DISABLE_SIGNUP = process.env.DISABLE_SIGNUP === "true";
|
||||
|
||||
// Trial constants
|
||||
export const TRIAL_DURATION_DAYS = 14;
|
||||
|
|
1
setup.sh
1
setup.sh
|
@ -31,6 +31,7 @@ cat > .env << EOL
|
|||
DOMAIN_NAME=${DOMAIN_NAME}
|
||||
BASE_URL=${BASE_URL}
|
||||
BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
|
||||
DISABLE_SIGNUP=false
|
||||
EOL
|
||||
|
||||
echo ".env file created successfully with domain ${DOMAIN_NAME}."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue