2018-06-19 11:15:10 +00:00
|
|
|
package migrator
|
2017-09-14 06:08:37 +00:00
|
|
|
|
2019-03-21 01:20:14 +00:00
|
|
|
import "github.com/portainer/portainer/api"
|
2017-09-14 06:08:37 +00:00
|
|
|
|
|
|
|
func (m *Migrator) updateEndpointsToDBVersion4() error {
|
2018-06-19 11:15:10 +00:00
|
|
|
legacyEndpoints, err := m.endpointService.Endpoints()
|
2017-09-14 06:08:37 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, endpoint := range legacyEndpoints {
|
|
|
|
endpoint.TLSConfig = portainer.TLSConfiguration{}
|
|
|
|
if endpoint.TLS {
|
|
|
|
endpoint.TLSConfig.TLS = true
|
|
|
|
endpoint.TLSConfig.TLSSkipVerify = false
|
|
|
|
endpoint.TLSConfig.TLSCACertPath = endpoint.TLSCACertPath
|
|
|
|
endpoint.TLSConfig.TLSCertPath = endpoint.TLSCertPath
|
|
|
|
endpoint.TLSConfig.TLSKeyPath = endpoint.TLSKeyPath
|
|
|
|
}
|
2018-06-19 11:15:10 +00:00
|
|
|
|
|
|
|
err = m.endpointService.UpdateEndpoint(endpoint.ID, &endpoint)
|
2017-09-14 06:08:37 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|