fix: skip loading env file if context is loaded

This commit is contained in:
Aarnav Tale 2024-11-04 18:00:50 -05:00
parent 13a734923d
commit 10bb4eba97
No known key found for this signature in database

View File

@ -35,16 +35,16 @@ export interface HeadplaneContext {
let context: HeadplaneContext | undefined
export async function loadContext(): Promise<HeadplaneContext> {
if (context) {
return context
}
const envFile = process.env.LOAD_ENV_FILE === 'true'
if (envFile) {
log.info('CTXT', 'Loading environment variables from .env')
await import('dotenv/config')
}
if (context) {
return context
}
const debug = process.env.DEBUG === 'true'
if (debug) {
log.info('CTXT', 'Debug mode is enabled! Logs will spam a lot.')