Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Add ServiceNames() to APIProject #462

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions project/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type APIProject interface {
Containers(ctx context.Context, filter Filter, services ...string) ([]string, error)

GetServiceConfig(service string) (*config.ServiceConfig, bool)
GetServiceNames() []string
}

// Filter holds filter element to filter containers
Expand Down
5 changes: 5 additions & 0 deletions project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,11 @@ func (p *Project) GetServiceConfig(name string) (*config.ServiceConfig, bool) {
return p.ServiceConfigs.Get(name)
}

// GetServiceNames returnes all service names in the project.
func (p *Project) GetServiceNames() []string {
return p.ServiceConfigs.Keys()
}

// IsNamedVolume returns whether the specified volume (string) is a named volume or not.
func IsNamedVolume(volume string) bool {
return !strings.HasPrefix(volume, ".") && !strings.HasPrefix(volume, "/") && !strings.HasPrefix(volume, "~")
Expand Down