mirror of
https://github.com/tale/headplane.git
synced 2026-08-20 09:52:19 +00:00
feat: load from dotenv if specified
This commit is contained in:
@@ -35,6 +35,12 @@ export interface HeadplaneContext {
|
||||
let context: HeadplaneContext | undefined
|
||||
|
||||
export async function loadContext(): Promise<HeadplaneContext> {
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user