Skip to main content

Environment Variables

About Environment Variables

Environment variables are widely used while writing application codes because of the following reasons:

  1. Configuration Management: Environment variables allow dynamic configuration of applications without altering the source code. They enable settings like port numbers, hostnames, and configuration flags to be modified without code changes.
  2. Security: They help secure sensitive data, such as API keys, database passwords, and other secrets, by keeping them out of the source code and version control systems.
  3. Portability and Flexibility: Environment variables enhance the portability of applications by enabling them to run in different environments (development, staging, production) with environment-specific configurations.
  4. Decoupling Configuration: By decoupling configuration from the application logic, environment variables make it easier to manage and change application settings based on the environment it is running in.
  5. Dependency Management: Environment variables are crucial for managing connections and interactions with databases and other services. They store connection strings, API endpoints, and other necessary information to interact with external systems.
  6. Simplifying Deployment: They simplify the deployment process by allowing environment-specific configurations to be injected at runtime, which is especially useful in automated deployment pipelines.

Atmosly allows you to declare environment variables while creating your proejcts.

Description of the image

Add environment variables

1. Open the Add Variable dialogue box

  • Navigate to the 'Environment Variables' section of your project and to the concerned service from the left menu.
  • Navigate to the three dots on the top right corner of the screen.
  • Click on 'Add' to open the Add Variable right drawer.

2. Enter Variable Details

  • Variable Name: Enter a name for your variable. This name should be descriptive enough to indicate the purpose of the variable.
  • Value From: Select the source of the variable's value. This could be manually entered or selected from predefined options.
  • Select Value: Depending on the selected source, choose the specific value from a dropdown menu. This dropdown menu dynamically displays values based on the datasources added to the project.
  • Specify If It Is a Secret: Toggle the switch labeled 'Is this a secret' if the variable you are adding contains sensitive information. Enabling this ensures the variable is encrypted and stored securely.
Description of the image
Description of the image

3. Create the Variable

  • Click 'Create' to add the variable to your project.
  • If you need to add multiple variables at once, click 'Create & Add another', which will save the current variable and reopen the dialog to add another.

Import environment variables

Import from Repository

Description of the image
  1. Select Import Source:

    • Navigate to the 'Environment Variables' section of your project and to the concerned service from the left menu.
    • Navigate to the three dots on the top right corner of the screen.
    • Click on 'Import', then select 'Repo' as the source.
  2. Choose Repository and Branch:

    • Select the repository from which you want to import the variables.
    • You will be prompted to select the branch that contains the .env file or other configuration files.
    • Click on Proceed to import.

Import from .env File

Description of the image
  1. Upload .env File:
    • Choose 'Upload .env file' as the source after clicking 'Import'.
    • Upload the .env file from your local system.

Import from Secret Manager

Description of the image
  1. Select Secret Manager Provider:
    • Choose 'Secrets' as the source.
    • For detailed steps on setting up and using a secrets management provider, refer to our Secrets Manager documentation.

Export Environment Variables from Atmosly

Exporting environment variables allows you to create a backup of your configurations or share them with other environments or team members.

Steps to Export Variables

  1. Navigate to Export Option:

    • Navigate to the 'Environment Variables' section of your project and to the concerned service from the left menu.
    • Navigate to the three dots on the top right corner of the screen.
    • Click on 'Export'.
  2. Export as .env File:

    • The variables will be exported into a .env file format.
    • Confirm the export, and the file will be downloaded to your local system.