Eventvisor

Advanced

Environments

Eventvisor on its own does not have any concept of environments, but it is possible to achieve environment-specific separation with your projects.

There are two ways to achieve this. Either by:

Using attributes

You can introduce a new attribute called environment in your project:

attributes/environment.yml
description: Environment
tags:
- web
type: string
enum:
- staging
- production

Setting environment attribute

From your application, you can set the value of this attribute to either staging or production:

eventvisor.setAttribute("environment", "staging");

Environment as condition

This can later be utilized in various different entities when applying conditions:

destinations/browser.yml
# ...
conditions:
- source: environment
operator: equals
value: staging

Challenges

This approach has its challenges, especially because you are still relying on a single Eventvisor project which will directly impact all environments together when the datafiles are deployed, even though you are making use of environment-specific conditions.

Solution

To overcome this, you can create separate Eventvisor projects for each environment.

We tackle that below.

Creating separate projects

Easiest approach would be to create separate Eventvisor projects for each environment.

And you can do that either in:

  • Separate repository per environment, or
  • Single repository with multiple projects for each environment

The second approach is more convenient, if you wish to achieve a single source of truth for all your Eventvisor projects in the organization.

Learn more about the implementation in monorepo guide.

Previous
CLI
Next
Tags