Skip to content

Environment vars (Angular standard) instead of idea-config.js

Choose a tag to compare

@uatisdeproblem uatisdeproblem released this 14 Sep 17:01

The projects updating the IDEA Ionic Extra modules to this version need to move their front-end configuration from src/assets/configs/idea-config.js (to delete) to the src/environments files. E.g.

export const environment = {
  idea: {
    project: 'cloud-app-starter',
    ionicExtraModules: ['common', 'auth'],
    ...
  }
  ...
}

Then, they need to add the following configuration in the front-end/tsconfig.json file:

{
   ...
  "compilerOptions": {
    ...
    "paths": {
      ...
      "@env": ["../front-end/src/environments/environment.ts"]
    }
   ...
}

To refer to the environment variables in the project, you can do as follows:

import { environment as env } from '@env';

myFun() {
  console.log(env.idea.project);
}

Follow the instructions in each module, to know which variables are needed (anyway, they didn't change).

For a full example, take a look at the cloud-app project in the https://github.com/iter-idea/starters repo.