fix(bolt): migrate empty templates URL settings (#3856)

2.0
Anthony Lapenna 2020-05-25 18:10:02 +12:00 committed by Anthony Lapenna
parent 01d8c90348
commit 334c015f81
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package migrator
import portainer "github.com/portainer/portainer/api"
func (m *Migrator) updateSettingsToDB24() error {
legacySettings, err := m.settingsService.Settings()
if err != nil {
return err
}
if legacySettings.TemplatesURL == "" {
legacySettings.TemplatesURL = portainer.DefaultTemplatesURL
return m.settingsService.UpdateSettings(legacySettings)
}
return nil
}

View File

@ -320,5 +320,13 @@ func (m *Migrator) Migrate() error {
}
}
// Portainer 2.0
if m.currentDBVersion < 24 {
err := m.updateSettingsToDB24()
if err != nil {
return err
}
}
return m.versionService.StoreDBVersion(portainer.DBVersion)
}