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

Commit 2965541

Browse files
author
Ian Campbell
committed
Define constants for credential paths.
Right now this is just the docker context. Signed-off-by: Ian Campbell <ijc@docker.com>
1 parent 008ec34 commit 2965541

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

cmd/cnab-run/env.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"os"
55

6+
"github.com/docker/app/internal"
67
"github.com/docker/cli/cli/command"
78
cliconfig "github.com/docker/cli/cli/config"
89
"github.com/docker/cli/cli/context/docker"
@@ -11,10 +12,6 @@ import (
1112
cliflags "github.com/docker/cli/cli/flags"
1213
)
1314

14-
const (
15-
fileDockerContext = "/cnab/app/context.dockercontext"
16-
)
17-
1815
var storeConfig = contextstore.NewConfig(
1916
func() interface{} { return &command.DockerContext{} },
2017
contextstore.EndpointTypeGetter(docker.DockerEndpoint, func() interface{} { return &docker.EndpointMeta{} }),
@@ -23,7 +20,7 @@ var storeConfig = contextstore.NewConfig(
2320

2421
func setupDockerContext() (command.Cli, error) {
2522
s := contextstore.New(cliconfig.ContextStoreDir(), storeConfig)
26-
f, err := os.Open(fileDockerContext)
23+
f, err := os.Open(internal.CredentialDockerContextPath)
2724
if err != nil {
2825
return nil, err
2926
}

internal/names.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const (
3434

3535
// CredentialDockerContextName is the name of the credential containing a Docker context
3636
CredentialDockerContextName = "docker.context"
37+
// CredentialDockerContextPath is the path to the credential containing a Docker context
38+
CredentialDockerContextPath = "/cnab/app/context.dockercontext"
3739

3840
// DockerStackOrchestratorEnvVar is the environment variable set by the CNAB runtime to select
3941
// the stack orchestrator.

internal/packager/cnab.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func ToCNAB(app *types.App, invocationImageName string) (*bundle.Bundle, error)
9292
return &bundle.Bundle{
9393
Credentials: map[string]bundle.Location{
9494
internal.CredentialDockerContextName: {
95-
Path: "/cnab/app/context.dockercontext",
95+
Path: internal.CredentialDockerContextPath,
9696
},
9797
},
9898
Description: app.Metadata().Description,

0 commit comments

Comments
 (0)