Configuration

Configure Nesula for different environments

Nesula has default configuraiton files for three environments:

  • Development

  • Staging

  • Production

When deployment scripts are run the file for that environment replaces the file Angular or NestJS applications use.

Environment Configuration Files

Environment
Angular
NestJS

File Nesula uses

environment.ts

.env

Development

environment.dev.ts

.env.dev

Staging

environment.stage.ts

.env.stage

Production

environment.prod.ts

.env.prod

Node Process Environment

Values from the NestJS .env file are loaded in the node run time e.g. NODE_ENV

They are available in NestJS as:

process.env.NODE_ENV

Configuration Service

Nesula provides configuration services to access environment data for both Angular & NestJS.

NestJS

Environment configuration service is available in NestJS as follows:

The .env files are loaded into the config module in app.module.ts from file:

import configuration from './_common/config/configuration'

With the application this config may be access by:

import { ConfigService } from '@nestjs/config'

...

appUrl: string = this.configService.get('url.app')

Angular

Environment configuration is available directly from the environment file:

import { environment } from '@environments/environment'

...

baseUrl = environment.apiUrl;

Last updated

Was this helpful?