Variables

Enabling referencing in environments

Introduction

Variables in Bunnyshell are values defined in the platform, which are evaluated into Environment Variables within the running containers of environments created by Bunnyshell.

 

Encryption & Secrets

The encryption/decryption is performed with a key dedicated for each Organization.

📘

All variables are encrypted in Bunnyshell, whether or not the Secret option is checked.

Compared to non-secret variables, Secrets are obfuscated within the UI.

 

Inheritance & override

There are 3 scopes at which variables can be defined, from lower to higher:

  1. Project
  2. Environmnet
  3. Component

Variables and their values are inherited from the Project scope into the Environment scope, and then into the Component scope.

Overriding values is possible by defining the same variable with a different value at a higher scope.

Example for Environment scope overriding the Project scope
Let's say we have a variable called APP_VERSION defined at Project level with value 1.1.
We define the same variable with a different value at an Environment level: 2.0.
When injected in each of the containers belonging to all the Components of the respective Environment, the value of APP_VERSION will be 2.0.

The same way, Component scope will override both Environment scope, as well as Project scope.

🚧

So

Environment variables override Project variables.

Component variables override both Project and Environment variables.

 

Project Variables

Project variables are automatically inherited in all new environments from a specific project. These will be available at runtime, as well as during builds and deploys.

Project variables are unique for the entire project and their values can be overridden both at the environment and component level.

Creating a Project Variable

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 keys should not contain dash “-”.
  • Variable names cannot contain more than 255 characters.
  • Variable names cannot contain less than 3 characters.
  1. Choose whether your variable should be a secret one or not.
  2. Finally, click the Create variable button.

Editing or Deleting a Project Variable

  1. Go to the Project variables screen.
  2. Click the Options button corresponding to the variable in question.
  3. Choose the desired action: Edit or Delete.

 

Environment Variables

Environment variables are automatically inherited in all applications, services, and databases inside the Environment. These are available at runtime, as well as during builds and deploys.

Environment variables are unique for the entire environment and their values can be overridden only at the component level.

Creating an Environment Variable

To create environment variables, the first thing you have to do is access the Environment View screen:

  1. Select the environment for which you want to add a variable.
  2. Click on your environment's Settings button.
  3. On the left-side menu, click Environment variables.
  4. Click Create variable.
  5. 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 keys should not contain dash “-”.
  • Variable names cannot contain more than 255 characters.
  • Variable names cannot contain less than 3 characters.
  1. Choose whether your variable should be a secret one or not.
  2. Finally, click the Create variable button.

Editing or Deleting an Environment Variable

  1. Go to the Environment variables screen.
  2. Click the Options button corresponding to the variable in question.
  3. Choose the desired action: Edit or Delete.

 

Component Variables

Component variables are available:

These variables are unique for the component where they are defined and cannot be overridden further.

Creating a Component Variable

To create Component variables, the first thing you have to do is access the Environment View screen:

  1. Select an Environment.
  2. Choose a Component.
  3. From the left-side menu, navigate to the desired component.
  4. Click Actions, and then Variables.
  5. You will see the Variables screen. From there, 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 keys should not contain dash “-”.
  • Variable names cannot contain more than 255 characters.
  • Variable names cannot contain less than 3 characters.
  1. Choose whether your variable should be a secret one or not.
  2. Finally, click the Create variable button.

Editing or Deleting a Component Variable

  1. Select an Environment.
  2. Choose a Component.
  3. From the left-side menu, navigate to the desired component.
  4. Click Actions, and then Variables.
  5. You will see the Variables screen. From there, click Delete from within the Actions (3-dots) menu.