Skip to content

env vars not loaded in .ember-cli.js #86

@emattias

Description

@emattias

process.env doesnt have any of our dotenv vars in .ember-cli.js that we have in the rest of the ember app.

.ember-cli.js is executed before our config/dotenv.js.

We were able to work around it by doing this. But it would be nice to use ember-cli-dotenv like we do for all other env vars :) :

// .ember-cli.js

const dotEnv = require('dotenv');
const path = require('path');
const fs = require('fs');
const configDotEnv = require('./config/dotenv');

const { path: configPath } = configDotEnv(
  process.env.NODE_ENV || 'development'
);

const absoluteConfigPath = path.join(__dirname, configPath);
if (fs.existsSync(absoluteConfigPath)) {
  dotEnv.config({ path: absoluteConfigPath });
}

setEdition('octane');

let httpOrHttps = process.env.USE_SSL ? 'https' : 'http';
let port = process.env.USE_SSL ? 443 : 80;

module.exports = {
  disableAnalytics: true,
  port: 4200,
  liveReload: true,
  liveReloadPort: 1337,
  host: '0.0.0.0',
  ...
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions