From ae18b214e13ad84da7dee5fc23e89a75238f9309 Mon Sep 17 00:00:00 2001 From: Iwasaki Yudai Date: Fri, 5 May 2017 14:17:57 -0700 Subject: [PATCH] Add project.GetName() Currently we don't have a way to access the name of projects, which are sometimes normalized internally. Signed-off-by: Iwasaki Yudai --- project/interface.go | 1 + project/project.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/project/interface.go b/project/interface.go index 3356407c2..136904146 100644 --- a/project/interface.go +++ b/project/interface.go @@ -40,6 +40,7 @@ type APIProject interface { Load(bytes []byte) error Containers(ctx context.Context, filter Filter, services ...string) ([]string, error) + GetName() string GetServiceConfig(service string) (*config.ServiceConfig, bool) } diff --git a/project/project.go b/project/project.go index ef783120a..bb48d2b14 100644 --- a/project/project.go +++ b/project/project.go @@ -540,6 +540,11 @@ func (p *Project) Notify(eventType events.EventType, serviceName string, data ma } } +// GetName returns the name of the project. +func (p *Project) GetName() string { + return p.Name +} + // GetServiceConfig looks up a service config for a given service name, returning the ServiceConfig // object and a bool flag indicating whether it was found func (p *Project) GetServiceConfig(name string) (*config.ServiceConfig, bool) {