1

I've got a staging environment where I'd like to set a custom set of variables for deploying my Ember.js app and I'm drawing a blank on how to do it correctly. I am using the ember-cli-rails gem. According to the documentation for that:

EMBER_ENV: If set on the environment, the value of EMBER_ENV will be passed to the ember process as the value of the --environment flag.

I'm just drawing a blank on how to set it on the "environment".

/project/frontend/config/environment.js

if (environment === 'test') {
  // Testem prefers this...
  ENV.baseURL = '/';
  ENV.locationType = 'none';

  // keep test console output quieter
  ENV.APP.LOG_ACTIVE_GENERATION = false;
  ENV.APP.LOG_VIEW_LOOKUPS = false;

  ENV.APP.rootElement = '#ember-testing';
}

if (environment === 'staging') {
  ENV.apiHost = '/app-data';
  ENV.contentSecurityPolicy = contentSecurityPolicy;
  ENV.torii = {
    providers: {
      'my-custom-oauth2': {
        apiKey: '1234123412341234123412341234',
        baseUrl: 'http://www.server.com:9108/oauth/authorize'
      }
    }
  };
}

if (environment === 'production') {
  ENV.apiHost = '/app-data';
  ENV.contentSecurityPolicy = contentSecurityPolicy;

Things I've tried so far:

  • Setting export EMBER_ENV='staging' in my deployer user's .profile
  • Setting set :default_env, { 'EMBER_ENV' => 'staging' } in my /config/deploy/staging.rb file.
GSP
  • 3,763
  • 3
  • 32
  • 54
  • Why tag this as `linux`? I'm afraid this is not a linux question. Why not tag it also as `laptop` (in case you run it on a laptop) or `denver` (in case you're located in Denver) – Luis Colorado Jan 28 '16 at 09:09
  • Specifically setting a linux environment variable rather than a windows environment variable. – GSP Jan 28 '16 at 13:12
  • is setting an environment variable enough to tag it `linux` ??? so why not tag it with the brand of computer you are running on... and the city you live in also... perhaps the problem is there and the major of your city must be advised to solve something about it. Have you think in taggin it `bash` and `perl` and `python` (all these languages have some way to set environment variables). Perhaps `C` is also fine. And `lisp`.... you can set environment variables in all these languages. – Luis Colorado Jan 29 '16 at 08:31
  • Believe me or not... but just getting to see the problem as a linux expert and seeing this is just wasting time, as I cannot help you with the matter. – Luis Colorado Jan 29 '16 at 08:32
  • Yes, I believe that you cannot help with this matter. – GSP Jan 29 '16 at 13:51

1 Answers1

0

Unfortunately, ember cli only support test, development and production as valid environments

The ENV object contains three important keys:

  • EmberENV can be used to define Ember feature flags (see the Feature Flags guide).
  • APP can be used to pass flags/options to your application instance.
  • environment contains the name of the current environment (development, production or test).

There are several unofficial solutions to this out there, some of them use ember-cli-deploy and change the settings based on deployTarget value. Others use dotenv to manage each environment settings.

We're dealing with this at the moment and couldn't find a solution that feels right.

Axxiss
  • 4,759
  • 4
  • 26
  • 45