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.
- Predefined defaults
- Root1 global configuration
- Root1 project configuration
- Named2 global configuration
- Named2 project configuration
- Nested3 global configuration
- Nested3 project configuration
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