feat: implement config:import command

Closes #6846
This commit is contained in:
Jose Diaz-Gonzalez
2025-11-08 01:02:19 -05:00
parent 48fd2b3862
commit e134c314ea
13 changed files with 477 additions and 12 deletions

View File

@@ -30,7 +30,7 @@ func GetWithDefault(appName string, key string, defaultValue string) (value stri
}
// SetMany variables in the environment. If appName is empty the global config is used. If restart is true the app is restarted.
func SetMany(appName string, entries map[string]string, restart bool) (err error) {
func SetMany(appName string, entries map[string]string, replace bool, restart bool) (err error) {
global := appName == "" || appName == "--global"
env, err := loadAppOrGlobalEnv(appName)
if err != nil {
@@ -42,6 +42,10 @@ func SetMany(appName string, entries map[string]string, restart bool) (err error
return
}
}
if replace {
env.Clear()
}
for k, v := range entries {
env.Set(k, v)
keys = append(keys, k)
@@ -128,6 +132,10 @@ func UnsetAll(appName string, restart bool) (err error) {
}
func triggerRestart(appName string) {
if !common.IsDeployed(appName) {
return
}
common.LogInfo1(fmt.Sprintf("Restarting app %s", appName))
_, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
Trigger: "release-and-deploy",