feat: add GetSecretNamesForStack, tidy up GetConfigNamesForStack
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"coopcloud.tech/abra/pkg/i18n"
|
||||
appPkg "coopcloud.tech/abra/pkg/app"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
@ -49,14 +50,15 @@ func GetConfigNameAndVersion(fullName string, stackName string) (string, string)
|
||||
}
|
||||
|
||||
// GetConfigNamesForStack retrieves all Docker configs attached to services in a given stack.
|
||||
func GetConfigNamesForStack(cl *client.Client, ctx context.Context, stackName string) ([]string, error) {
|
||||
// Create filter to get services for the specific stack
|
||||
filter := filters.NewArgs()
|
||||
filter.Add("label", "com.docker.stack.namespace="+stackName)
|
||||
func GetConfigNamesForStack(cl *client.Client, app appPkg.App) ([]string, error) {
|
||||
filters, err := app.Filters(false, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// List all services in the stack
|
||||
services, err := cl.ServiceList(ctx, types.ServiceListOptions{
|
||||
Filters: filter,
|
||||
services, err := cl.ServiceList(context.Background(), types.ServiceListOptions{
|
||||
Filters: filters,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user