Merge pull request #9141 from dmcgowan/config-migration
Add support for plugin config migration
This commit is contained in:
@@ -203,6 +203,19 @@ func New(ctx context.Context, config *srvconfig.Config) (*Server, error) {
|
||||
required[r] = struct{}{}
|
||||
}
|
||||
|
||||
// Run migration for each configuration version
|
||||
// Run each plugin migration for each version to ensure that migration logic is simple and
|
||||
// focused on upgrading from one version at a time.
|
||||
for v := config.Version; v < srvconfig.CurrentConfigVersion; v++ {
|
||||
for _, p := range plugins {
|
||||
if p.ConfigMigration != nil {
|
||||
if err := p.ConfigMigration(ctx, v, config.Plugins); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, p := range plugins {
|
||||
id := p.URI()
|
||||
log.G(ctx).WithField("type", p.Type).Infof("loading plugin %q...", id)
|
||||
|
||||
Reference in New Issue
Block a user