mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 03:53:33 +00:00
feat(compose): plan compose deployment
This commit is contained in:
@@ -12,23 +12,21 @@ type PortsSource []string
|
||||
|
||||
// TransformServicesPortsExtension transforms the ports extension of all services in the project by replacing a string
|
||||
// representation of each port with a parsed PortSpec.
|
||||
func transformServicesPortsExtension(project *types.Project) error {
|
||||
for name, service := range project.Services {
|
||||
func transformServicesPortsExtension(project *types.Project) (*types.Project, error) {
|
||||
return project.WithServicesTransform(func(name string, service types.ServiceConfig) (types.ServiceConfig, error) {
|
||||
ports, ok := service.Extensions[PortsExtensionKey].(PortsSource)
|
||||
if !ok {
|
||||
continue
|
||||
return service, nil
|
||||
}
|
||||
|
||||
specs, err := transformPortsExtension(ports)
|
||||
if err != nil {
|
||||
return err
|
||||
return service, err
|
||||
}
|
||||
|
||||
service.Extensions[PortsExtensionKey] = specs
|
||||
project.Services[name] = service
|
||||
}
|
||||
|
||||
return nil
|
||||
return service, nil
|
||||
})
|
||||
}
|
||||
|
||||
func transformPortsExtension(ports PortsSource) ([]api.PortSpec, error) {
|
||||
|
||||
Reference in New Issue
Block a user