core icon indicating copy to clipboard operation
core copied to clipboard

Native support for .env files

Open mdonnalley opened this issue 9 months ago • 5 comments

Is your feature request related to a problem? Please describe.

@oclif/core should natively support .env files using process.loadEnvFile

Describe the solution you'd like

Call process.loadEnvFile at the beginning of run using path set in settings

The call should be gated by a check for the node version to avoid any runtime errors.

mdonnalley avatar May 06 '24 17:05 mdonnalley

This issue has been linked to a new work item: W-15694504

git2gus[bot] avatar May 06 '24 17:05 git2gus[bot]

Is there any workaround for supporting .env files in oclif?

beforeoafterm avatar Jul 10 '24 07:07 beforeoafterm

You can you use dotenv in CLI's bin/run.js to load a .env file

mdonnalley avatar Jul 10 '24 15:07 mdonnalley

You can you use dotenv in CLI's bin/run.js to load a .env file

@mdonnalley I see! I've already done this actually. 😄 But how can I make that work for the bin/run.cmd bin file for Windows?

beforeoafterm avatar Jul 11 '24 00:07 beforeoafterm

bin/run.cmd just runs bin/run.js so whatever you do in there should also work for windows

mdonnalley avatar Jul 11 '24 15:07 mdonnalley