Scopes
Altostra configuration can be applied both globally and on a per-project basis.
When both kinds of configuration are present - the local configuration takes precedence, inherits the global configuration and can override its settings.
When changing configuration, by default only the local configuration is being changed.
In order to change the global configuration, we add the --global
option to the
alto config
command.
Local vs. Global configuration
Before we start, let's see what our default configuration is:
alto config list
✔ Listing configuration:
active-config: (String)
autoLogin: true (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: false (Boolean)
Suppose we have two project directories: project-1
and project-2
.
We will start by adding some global configuration.
alto config set autoLogin false --global
alto config set requireCleanRepositoryOnPush true --global
alto config list
✔ Listing configuration:
active-config: (String)
autoLogin: false (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: true (Boolean)
Now, we can cd
into both projects.
From each project, we can run alto config list
and see that our configuration applied
to both of them - because that configuration was applied globally.
From project-1
, let's reenable autoLogin
:
cd project-1
alto config set autoLogin true
alto config list
The configuration was applied successfully:
✔ Listing configuration:
active-config: (String)
autoLogin: true (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: true (Boolean)
But because we applied that configuration locally, it does not apply to the other project:
cd ../project-2
alto config list
✔ Listing configuration:
active-config: (String)
autoLogin: false (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: true (Boolean)
Resetting local configuration
Back to project-1
cd ../project-1
Our project-1
now has locally applied configuration for autoLogin
.
Suppose we would like to revert it and use the global configuration again.
One thing we could do - is just set the configuration to mimic the global configuration:
alto config set autoLogin false
alto config list
✔ Listing configuration:
active-config: (String)
autoLogin: false (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: true (Boolean)
While this appears to work, project-1
still does not use the global configuration for
autoLogin
. Just a locally set value, that at this point in time resembles the global configuration.
If in the future we would like to reenable autoLogin
globally - the local configuration
will still override it.
alto config set autoLogin true --global
alto config list
It appears as if the configuration did not apply.
✔ Listing configuration:
active-config: (String)
autoLogin: false (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: true (Boolean)
Thus, setting the local configuration to mimic the global configuration does not solve
the problem.
To actually remove the local configuration we need to unset it.
Unsetting a configuration means that we remove the configuration entirely. If we remove a local configuration Altostra will fall back to the global configuration, and if we unset a global configuration Altostra will fall back to predefined defaults.
alto config unset autoLogin
alto config list
And now we can see that setting autoLogin
globally did apply
✔ Listing configuration:
active-config: (String)
autoLogin: true (Boolean)
currentTeam: (String)
requireCleanRepositoryOnPush: true (Boolean)