-
Notifications
You must be signed in to change notification settings - Fork 3
Environments
Wiki ▸ Conventions ▸ General ▸ Environments
This page will go through how we manage environments and environment variables in our project.
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_.
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.
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.
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.
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
.propertiesof the active configuration will be loaded alongside the mainapplication.propertiesand the profile-specific file will override all common properties between the two.
Wiki | Site | Project Roadmap | Figma