Skip to main content

Namespaces

Namespaces are named configuration sets that can be activated and switched so we can have different configurations applied for different scenarios.

For instance, we could set requireCleanRepositoryOnPush true in a configuration named production, use that when releasing and deploying a version to production, and use other configuration when deploying in development environment.

Setting an active namespace

To set an active namespace, we just set the active-config configuration:

alto config set active-config my-namespace

alto config get active-config
✔ Getting configuration [active-config]
my-namespace (String)

When a namespace is set - configuration is being set in that namespace. Changing the namespace will apply the settings that were set in that namespace.

alto config set autoLogin false

alto config list
✔ Listing configuration:
active-config: my-namespace (String)
autoLogin: false (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: true (Boolean)
# The "" empty-string named namespace is the root namespace
alto config set active-config ""

alto config list

Notice that autoLogin was reverted to its original value.

✔ Listing configuration:
active-config: (String)
autoLogin: true (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: true (Boolean)

Reactivating my-namespace namespace will also set autoLogin as it was set in that namespace:

alto config set active-config my-namespace

alto config list
✔ Listing configuration:
active-config: my-namespace (String)
autoLogin: false (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: true (Boolean)

Namespace hierarchies

A namespace may contain nested namespaces - those are namespaces that inherit their parent namespace configuration while adding or overriding configuration keys.
In fact, all namespaces are nested under the root "" namespace.

To create a nested namespace we simply name it: <parent-namespace>::<nested-namespace>.
Notice that <parent-namespace> might be a nested namespace on its own.

Let's create a nested namespace called nested under our previous my-namespace namespace.

alto config set active-config my-namespace::nested

alto config list

As you can see, it just inherited its configuration from my-namespace.

✔ Listing configuration:
active-config: my-namespace::nested (String)
autoLogin: false (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: true (Boolean)

Now we can update the nested namespace without changing its parent.

alto config set requireCleanRepositoryOnPush false

alto config list
✔ Listing configuration:
active-config: my-namespace::nested (String)
autoLogin: false (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: false (Boolean)

And check that the parent namespace wasn't changed.

alto config set active-config my-namespace

alto config list
✔ Listing configuration:
active-config: my-namespace (String)
autoLogin: false (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: true (Boolean)

Configuration precedence

As configuration is inherited and may be overridden - the following list lists the configuration sources (scope + namespace) from the most general (everything inherits it; it cannot override anything) to the most specific (not inherited, and can override settings from all its ancestors).

It is worth mentioning that not all configuration sources may be present: Using a named namespace is optional. Also, a project can have no local configuration.

  1. Predefined defaults
  2. Root1 global configuration
  3. Root1 project configuration
  4. Named2 global configuration
  5. Named2 project configuration
  6. Nested3 global configuration
  7. Nested3 project configuration
1 Root means settings from the root, unnamed, namespace
2 Named means settings from a named namespace which is the parent of the currently set `active-config`
3 Nested means settings from a nested namespace

Ready to Get Started?

Get Started for Free
© 2023 Altostra, Inc.