Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
emattias opened this issue Mar 23, 2020 · 1 comment
Open

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

emattias opened this issue Mar 23, 2020 · 1 comment

Comments

@emattias
Copy link

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',
  ...
};
@SergeAstapov
Copy link
Collaborator

@emattias I fear this is impossible to overcome by design as addons are not loaded at the time .ember-cli.js runs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants