@@ -61,13 +61,10 @@ export class AuthManager {
6161 secret : this . config . secret || this . generateSecret ( ) ,
6262 baseURL : this . config . baseUrl || 'http://localhost:3000' ,
6363
64- // Database adapter - use memory for now
65- // In production, use appropriate database adapter
66- database : {
67- // Using in-memory adapter for development
68- // @TODO : Implement proper database adapter
69- adapter : 'better-sqlite3' as any ,
70- } as any ,
64+ // Database adapter configuration
65+ // For now, we configure a basic setup that will be enhanced
66+ // when database URL is provided and drizzle-orm is available
67+ database : this . createDatabaseConfig ( ) ,
7168
7269 // Email configuration
7370 emailAndPassword : {
@@ -84,13 +81,50 @@ export class AuthManager {
8481 return betterAuth ( betterAuthConfig ) ;
8582 }
8683
84+ /**
85+ * Create database configuration
86+ * TODO: Implement proper database adapter when drizzle-orm is available
87+ */
88+ private createDatabaseConfig ( ) : any {
89+ // If databaseUrl is provided, we would use drizzle adapter
90+ // For now, this is a placeholder configuration
91+ if ( this . config . databaseUrl ) {
92+ console . warn (
93+ 'Database URL provided but adapter integration not yet complete. ' +
94+ 'Install drizzle-orm and configure a proper adapter for production use.'
95+ ) ;
96+ }
97+
98+ // Return a minimal configuration that better-auth can work with
99+ // This will need to be replaced with a proper adapter
100+ return {
101+ // Placeholder - will be replaced with actual adapter
102+ adapter : 'in-memory' as any ,
103+ } ;
104+ }
105+
87106 /**
88107 * Generate a secure secret if not provided
89108 */
90109 private generateSecret ( ) : string {
91- // In production, this should come from environment variables
92- // This is just a fallback for development
93- return process . env . AUTH_SECRET || 'default-secret-change-in-production' ;
110+ const envSecret = process . env . AUTH_SECRET ;
111+
112+ if ( ! envSecret ) {
113+ // In production, a secret MUST be provided
114+ // For development/testing, we'll use a fallback but warn about it
115+ const fallbackSecret = 'dev-secret-' + Date . now ( ) ;
116+
117+ console . warn (
118+ '⚠️ WARNING: No AUTH_SECRET environment variable set! ' +
119+ 'Using a temporary development secret. ' +
120+ 'This is NOT secure for production use. ' +
121+ 'Please set AUTH_SECRET in your environment variables.'
122+ ) ;
123+
124+ return fallbackSecret ;
125+ }
126+
127+ return envSecret ;
94128 }
95129
96130 /**
0 commit comments