feat: load from dotenv if specified

This commit is contained in:
Aarnav Tale
2024-10-16 23:07:17 -04:00
parent 0c1f6969da
commit 9dafd8e8b0
3 changed files with 10 additions and 0 deletions
+6
View File
@@ -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
}