Search code examples
ember.jsember-dataember-cli

How to determine the environment of your ember app


How can I access the environment of my ember application? My goal is to have a computed property called isStaging to check if the environment is staging


Solution

  • you don't need a computed property, but you can just do this:

    import Component from '@ember/component';
    
    import ENV from 'app-name/config/environment';
    
    export default class extends Component {
      isStaging = ENV.environment === 'staging';
    }
    
    // or if you're on the old syntax:
    
    export default Component.extend({
      isStaging: ENV.environment === 'staging'
    });