github.com/click2cloud/libcompose@v0.4.1-0.20170816121048-7c20f79ac6b9/docker/service/service_factory.go (about) 1 package service 2 3 import ( 4 "github.com/Click2Cloud/libcompose/config" 5 "github.com/Click2Cloud/libcompose/docker/ctx" 6 "github.com/Click2Cloud/libcompose/project" 7 ) 8 9 // Factory is an implementation of project.ServiceFactory. 10 type Factory struct { 11 context *ctx.Context 12 } 13 14 // NewFactory creates a new service factory for the given context 15 func NewFactory(context *ctx.Context) *Factory { 16 return &Factory{ 17 context: context, 18 } 19 } 20 21 // Create creates a Service based on the specified project, name and service configuration. 22 func (s *Factory) Create(project *project.Project, name string, serviceConfig *config.ServiceConfig) (project.Service, error) { 23 return NewService(name, serviceConfig, s.context), nil 24 }