Configuration (environment) - mgechev/angular-seed GitHub Wiki
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.ts
to add the variables required.
- Create and / or edit configurations
- In
tools/env/
, for exampletools/env/dev.ts
- As an example, create a
test.ts
so 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