fix: skip loading env file if context is loaded
This commit is contained in:
parent
13a734923d
commit
10bb4eba97
@ -35,16 +35,16 @@ export interface HeadplaneContext {
|
|||||||
let context: HeadplaneContext | undefined
|
let context: HeadplaneContext | undefined
|
||||||
|
|
||||||
export async function loadContext(): Promise<HeadplaneContext> {
|
export async function loadContext(): Promise<HeadplaneContext> {
|
||||||
|
if (context) {
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
const envFile = process.env.LOAD_ENV_FILE === 'true'
|
const envFile = process.env.LOAD_ENV_FILE === 'true'
|
||||||
if (envFile) {
|
if (envFile) {
|
||||||
log.info('CTXT', 'Loading environment variables from .env')
|
log.info('CTXT', 'Loading environment variables from .env')
|
||||||
await import('dotenv/config')
|
await import('dotenv/config')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context) {
|
|
||||||
return context
|
|
||||||
}
|
|
||||||
|
|
||||||
const debug = process.env.DEBUG === 'true'
|
const debug = process.env.DEBUG === 'true'
|
||||||
if (debug) {
|
if (debug) {
|
||||||
log.info('CTXT', 'Debug mode is enabled! Logs will spam a lot.')
|
log.info('CTXT', 'Debug mode is enabled! Logs will spam a lot.')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user