-
Couldn't load subscription status.
- Fork 1.4k
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).
- Define configuration variables
- Edit
src/client/app/shared/config/env.config.tsto add the variables required.
- Create and / or edit configurations
- In
tools/env/, for exampletools/env/dev.ts - As an example, create a
test.tsso as to be able to specify different backend servers for testing
-
Use in application - Import and use the Config:
import { Config } from '../config/env.config'; private webServiceURL: string = Config.WEBSERVICEURL; -
Run node server using configuration
npm start -- --env-config test -
Observe the values
- By default the Configuration object is printed to the console when the application starts
- Adjust build to use configurations
- If you need to change the configurations during certain tasks, edit
package.json