Skip to content

Picking a specific dotenv file via CLI param #25

Description

@lolmaus

Hi!

I find splitting dotenv files by environment to be very restricting. I've seen whole blog posts arguing that it's a bad practice.

Instead, I organize my dotenv files by deploy target, e. g. development, staging, production. This unleashes my debugging capabilities, letting me make production builds against a local server and unminified builds against production server.

To achieve that, I use a very simple technique in ember-cli-build.js:

const target     = process.env.APPNAME_DEPLOY_TARGET || 'localhost-4200'
const dotEnvFile = `./.env-${target}`
if (!fs.existsSync(dotEnvFile)) throw new Error(`ember-cli-build.js: dot-env file not found: ${dotEnvFile}`)
      dotEnv: {
        path: dotEnvFile
      }

I believe this should be part of the addon. Doing ember s --dotenv .env-production is a feature that everyone would expect from the addon.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions