This commit is contained in:
10
lib/load-env.ts
Normal file
10
lib/load-env.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import dotenv from 'dotenv';
|
||||
import path from 'path';
|
||||
|
||||
/**
|
||||
* Loads environment variables from .env file in development.
|
||||
* This must be called before any other module that uses environment variables.
|
||||
*/
|
||||
if (typeof window === 'undefined' && process.env.NODE_ENV !== 'production') {
|
||||
dotenv.config({ path: path.resolve(process.cwd(), '.env') });
|
||||
}
|
||||
Reference in New Issue
Block a user