From f19c9315ea17f077958b647e9cca07768b790e7e Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Thu, 20 Jan 2022 16:42:13 +0300 Subject: [PATCH] [#324] Drop default container name Signed-off-by: Denis Kirillov --- authmate/authmate.go | 15 +++++++++++---- cmd/authmate/main.go | 1 - 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/authmate/authmate.go b/authmate/authmate.go index d6ed17f74..f2686788f 100644 --- a/authmate/authmate.go +++ b/authmate/authmate.go @@ -110,12 +110,19 @@ func (a *Agent) checkContainer(ctx context.Context, cid *cid.ID, friendlyName st return nil, fmt.Errorf("failed to build placement policy: %w", err) } - cnr := container.New( + cnrOptions := []container.Option{ container.WithPolicy(pp), container.WithCustomBasicACL(defaultAuthContainerBasicACL), - container.WithAttribute(container.AttributeName, friendlyName), - container.WithAttribute(container.AttributeTimestamp, strconv.FormatInt(time.Now().Unix(), 10))) - container.SetNativeName(cnr, friendlyName) + container.WithAttribute(container.AttributeTimestamp, strconv.FormatInt(time.Now().Unix(), 10)), + } + if friendlyName != "" { + cnrOptions = append(cnrOptions, container.WithAttribute(container.AttributeName, friendlyName)) + } + + cnr := container.New(cnrOptions...) + if friendlyName != "" { + container.SetNativeName(cnr, friendlyName) + } cid, err = a.pool.PutContainer(ctx, cnr) if err != nil { diff --git a/cmd/authmate/main.go b/cmd/authmate/main.go index 27cc28cf3..b1dd89145 100644 --- a/cmd/authmate/main.go +++ b/cmd/authmate/main.go @@ -197,7 +197,6 @@ func issueSecret() *cli.Command { Usage: "friendly name of auth container to put the secret into", Required: false, Destination: &containerFriendlyName, - Value: "auth-container", }, &cli.BoolFlag{ Name: "create-session-token",