Skip to content

Environments

CristiPV edited this page Sep 8, 2021 · 4 revisions

Wiki ▸ Conventions ▸ General ▸ Environments

Environments and Environment Variables

This page will go through how we manage environments and environment variables in our project.

Environment Variables

E-Learning Application

All of the environment variables in our frontend application are stored in a .env file that has to be created by each user individually at /main/apps/e-learning-app.

In the same folder, a .env-template can be found as well. It contains the names of all our current variables and an explanation of their values.

Due to this being an NX project, all variable names must start with the prefix: NX_.

API

We are using .env in our backend through a dependency called spring-dotenv. The .env file must be placed at main/apps/java-api/src/main/resources.

In the same folder, a .env-template can be found as well. It contains the names of all our current variables and an explanation of their values.

All of the environment variables used can be referenced in by using the following syntax: env.ENVIRONMENT_VARIABLE. For example, this is how an environment variable can be used in the application.properties:

spring.application.name=${env.APPLICATION_NAME:Scoala-Online}

The ':' is used to assign a default value, in case the environment variable specified does not exist.

Note: Every contributor that changes the variables we use is responsible for updating the .env-template to reflect those changes.

Environments

We have set up environments for both our application in order to work with specific configurations depending on the state of the application - in development or production.

E-Learning Application

The environment configuration can be done in the environments folder located here.
In the folder there is a .js file for each environment. Any environment-related configuration is to be defined in said files so that later it can be imported and used accordingly.

API

The environment-specific configurations are set up in the application.properties files located here.
There is a file for each profile, following the structure application-profile.properties and can be used by defining an active profile either through a property in the main application.properties or by using the CLI.

Note: The .properties of the active configuration will be loaded alongside the main application.properties and the profile-specific file will override all common properties between the two.

Getting Started

Conventions

  1. General

  1. REST API

  1. E-Learning App

Endpoints

Custom Components

Themes

Packages Used

  1. Global

  1. REST API

  1. E-Learning App

Clone this wiki locally