Skip to main content

Environments

Overview

Note: Abyss App Starter Kit only

Environments allow us to create different workspaces to develop our applications in. Each of these workspaces may require different variables depending on what stage of the development lifecycle they are in. To accomplish this Abyss utilizes a environments config file called environments.json under the .abyss config directory.

├── .abyss
| ├── environments.json
| └── settings.json

Abyss Configuration

The environments.json file is setup to help you designate your various environments including their desired name and associated variables. Below is a standard setup for the environment config.

{
"env": {
// Global variables
"APP_NAME": "Create Abyss App - Micro Frontend"
},
"env.dev": {
// Env specific variables
"ENV_VAR": "dev-only"
},
"env.test": {
"ENV_VAR": "test-only"
},
"env.stage": {
"ENV_VAR": "stage-only"
},
"env.prod": {
"ENV_VAR": "prod-only"
}
}

The env field allows you to define global variables that are applied to all environments. Environment variable names should follow the snake case standard.

To create a new environment you must first define the environment with env. followed by the name you wish to give the environment (i.e "env.prod"). Once defined, anything you add to the field can be accessed by that environment only.

Local

You may also need to have environment variables when you are running and developing your application locally. To accomplish this you can add the common .env file to the root of your project. Anything you add to this file can be accessed when running your application locally.

# Environment variables.
STATUS=production
API_KEY=secret
# Development port
DEV_PORT=7000

Abyss Config Tool

You can leverage the Abyss config() method to access both your .env and environments.json configurations inside your application. To learn more head to the config documentation.

Table of Contents