How Multi-env works

Current env

  • Every Salto workspace always has a current env set
  • Salto operations like fetchfetch - Syncs your workspace's NaCl files with the current env's services' state and deploydeploy - Deploys the current NaCl files config to the target env's services run on the current env

Meaningful folder structure

Let's imagine an advanced Salto user managing both Salesforce and NetSuite, with multiple envs, in the same workspace. Below is an example of what their workspace's folder structure might look like, followed by explanations.


Don't worry, the folders are on us

  • Salto fetch will generate this folder structure for you. All you need to do is configure more than one env and fetch each of them in turn

  • Each of Salto's service adapters is designed to generate its own folder structure and meaningful NaCl file names, to make it most intuitive to experts in each service

└─── envs
β”‚   └─── dev
β”‚   β”‚   └─── salesforce
β”‚   β”‚   β”‚   └─── ... // Salesforce config nacl files and folders
β”‚   β”‚   └─── netsuite
β”‚   β”‚   β”‚   └─── ... // NetSuite config nacl files and folders
β”‚   └─── integration
β”‚   β”‚   └─── ...
β”‚   └─── staging
β”‚   β”‚   └─── ...
β”‚   └─── production
β”‚   β”‚   └─── ...
└─── salesforce
β”‚   └─── ... // Salesforce config nacl files and folders
└─── netsuite
β”‚   └─── ... // NetSuite config nacl files and folders
└─── salto.config
β”‚   └─── ... // Salto config nacl files and folders

For salto.config, see Configuring adapters and Salto.

What each folder means

  • The complete config of an env is calculated by the union of Common Config and the relevant env-specific config
  • Common Config refers to all nacl files under /workspace/<adapter name>, e.g. /workspace/netsuite/...
  • Env-specific config refers to nacl files under an env folder, e.g. files under /workspace/envs/dev/... determine the config of dev env and no other env

In short, for a certain env:
complete config = common config + env-specific config

A practical example

Imagine making a simple change, like adding a custom field, in your dev env. You went to your sandbox admin UI and added the field. The next thing to do is make sure your current env is dev, and run fetchfetch - Syncs your workspace's NaCl files with the current env's services' state. Fetch will add the new field as a NaCl element under /workspace/envs/dev/<your service>.

So far we've used fetch to get the new field in NaCl form, and in our workspace. Now, based on your desired outcome, you should decide what action to take with the newly generated NaCl elements:

Desired outcome

Action to take

Add the new field to all envs, including production.

Move the new field's NaCl element to Common Config.

Salto has a tool for moving elements, see more below.

Keep the new field in dev only.

Nothing to do. Fetch already placed it where you need it.

Add the new field to all envs except production.

Clone the new field into all env-specific folders except production.

Salto has a tool for cloning elements, see more below.

Tools for Multi-env

Moving and cloning elements

Since the location of config elements is important, Salto-IDE comes with tools for quickly getting your NaCls to the state you need. To access these commands right-click the element ID at the top of one of its definition blocks.

Right-click option

What it does

Move Element from Common

Moves the selected element's definition from Common Config to all env-specific folders.

Move Element to Common

Moves the selected element's definition from the env you're right-clicking to Common Config.

All other env-specific definitions of this element are automatically removed.

Clone Element to Another Env

Copies the selected element's definition as it is in the env you're right-clicking, and pastes the same definition in the envs you choose.

The original definition remains untouched.

Restoring elements (coming soon)

In addition to NaCl files, Salto keeps the latest snapshot of each service under each env in a state file. While the state file is not human-readable, Salto-IDE provides useful access to that snapshot in the form of restore tools.

Right-click option

What it does

Restore Element from State

Runs in a context of an env, reads the selected element's definition from the env's state file and writes that definition to the corresponding env-specific folder and/or Common Config

Restore Align Element from State

Reads the selected element's definition from the selected state file, and since Salto elements support split definitions (see NaCl), it applies the following logic for each part of an element's definition:

  • Anything defined in Common Config remains untouched, i.e. as it was written in Common Config before the restore operation
  • Anything defined in the env-specific folder will get overridden from state

:information-source: For a deeper understanding of Salto's state file, see How Salto works.

Variables (vars for short)

Vars let you parametrize your config. It works by replacing a literal config value, like an email address or some number, with a named variable. Then in a different NaCl file you can assign the var a specific value. It's most useful with Common Config elements, where a small part of such an element needs to be different in each env.

Salto-IDE currently does not have tools for extracting vars - those are coming soon!

:information-source: To learn more about vars, see NaCl.

Coming soon

  • Envs diff: will provide a report of differences between any two envs managed under the same workspace

Did this page help you?