Skip to content

Configuration (environment)

Minko Gechev edited this page Oct 27, 2016 · 3 revisions

An application needs to setup different configurations, such as for different deployment environments (dev, test, prod).

  1. Define configuration variables
  • Edit src/client/app/shared/config/env.config.ts to add the variables required.
  1. Create and / or edit configurations
  • In tools/env/, for example tools/env/dev.ts
  • As an example, create a test.ts so as to be able to specify different backend servers for testing
  1. Use in application - Import and use the Config:

     import { Config } from '../config/env.config';
     private webServiceURL: string = Config.WEBSERVICEURL;
    
  2. Run node server using configuration

     npm start -- --env-config test
    
  3. Observe the values

  • By default the Configuration object is printed to the console when the application starts
  1. Adjust build to use configurations
  • If you need to change the configurations during certain tasks, edit package.json