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
No known key found for this signature in database
3 changed files with 10 additions and 0 deletions

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
}

View File

@ -24,6 +24,7 @@
"@remix-run/react": "^2.10.2",
"@remix-run/serve": "^2.10.2",
"clsx": "^2.1.1",
"dotenv": "^16.4.5",
"isbot": "^5.1.11",
"oauth4webapi": "^2.11.1",
"react": "19.0.0-rc-f38c22b244-20240704",

3
pnpm-lock.yaml generated
View File

@ -52,6 +52,9 @@ importers:
clsx:
specifier: ^2.1.1
version: 2.1.1
dotenv:
specifier: ^16.4.5
version: 16.4.5
isbot:
specifier: ^5.1.11
version: 5.1.11