Add root env loading and registration config
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import { config } from 'dotenv'
|
||||
import { fileURLToPath } from 'url'
|
||||
import { dirname, resolve } from 'path'
|
||||
|
||||
// Load environment variables
|
||||
config()
|
||||
// Load environment variables from root directory
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = dirname(__filename)
|
||||
const rootDir = resolve(__dirname, '../../..')
|
||||
|
||||
config({ path: resolve(rootDir, '.env') })
|
||||
|
||||
export const jwtConfig = {
|
||||
secret: process.env.JWT_SECRET || 'fallback-secret-for-development',
|
||||
|
||||
Reference in New Issue
Block a user