Connect services

Using Environment variables

Communication between services is done at the Component (Application) level, but it's mandatory to have the Service URLs configurable.

To communicate with a service, its host is read from the Env Vars available to the Application

Bunnyshell Built-in Variables

Bunnyshell facilitates the configuration of URLs in a dynamic manner. This you'll be able to use the Environment definition as a template to create other environments easily.

Encryption / Security

All the variables you defined in Bunnyshell are encrypted and stored in our database, regardless of whether they're marked as a Secret or not.

A Secret only has obfuscation of the values in the UI, offering screen-share protection.

Editing Env Vars

The Env Vars are variables available in Bunnyshell at 3 levels:

  • Project

  • Environment

  • Component (either application or service)

These variables can be created and edited both from both the User Interface and the env.yaml file.

Project Variables

To create project variables, the first thing you have to do is access the Projects screen:

1. Click on the project name in the upper-right corner of the Bunnyshell interface.

2. Select View all projects.

3. Click on your project's Settings button.

4. On the left-side menu, click Project variables.

5. Click Create variable.

6. Enter a name and a value and for your variable.

When choosing a name for your variable, make sure you take into account the following requirements:

  • Variable names should use only alphanumeric characters and the underscore character.

  • Variable names should not begin with a double underscore.

  • Variable names should not begin with BNS_.

  • Variable names cannot contain more than 255 characters.

  • Variable names cannot contain less than 3 characters.

7. Select the Scope of your variable. The following options are available in the drop-down menu:

  • Project: Project variables are visible inside the whole project.

  • Environment: Environment variables are visible for all applications, services and databases inside an environment.

  • Application: Application variables are visible for all applications inside an environment.

  • Service: Service variables are visible for all services inside an environment.

  • Database: Database variables are visible for all databases inside an environment.

8. Choose whether your variable should be a secret one or not. Secrets are encrypted and are only accessible during build and runtime.

9. Finally, click the Create variable button.

More information about this subject is available in our dedicated article linked below.

Environment Variables

To create environment variables, follow the steps below:

1. Click on the project name in the upper-right corner of the Bunnyshell interface.

2. Select View all projects.

3. Select the environment for which you want to add a variable.

4. Click on your environment's Settings button.

5. On the left-side menu, click Environment variables.

6. Click Create variable.

7. Enter a name and a value and for your variable.

When choosing a name, make sure you take in account the following requirements:

  • Variable names should use only alphanumeric characters and the underscore character.

  • Variable names should not begin with a double underscore.

  • Variable names should not begin with BNS_.

  • Variable keys should not contain dash “-”.

  • Variable names cannot contain more than 255 characters.

  • Variable names cannot contain less than 3 characters.

8. Choose whether your variable should be a secret one or not. Secrets are encrypted and are only accessible during build and runtime.

9. Finally, click the Create variable button.

Environment variables are automatically inherited in all applications, services, and databases inside the Environment.

Environment variables override Project variables.

Environment variables can be overridden by Component variables (Application or Service).

Component Variables

The Component Variables (Application / Service) are defined only in the env.yaml for the time being. They are available in a path of the following form:

components.SERVICE_NAME[*].dockerCompose.environment

This is also defined as a YAML map.

Inheritance mechanism

Variables are computed at deploy time, and are a result of merging Project, Environment and Application / Service variables.

Environment variables override Project variables.

Component (Application or Service) variables override both Environment and Project variables .

Last updated

Was this helpful?