refactor: handle STACK_NAME override in one place
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
777d49ac1d
commit
4a01e411be
@ -32,17 +32,13 @@ var appDeployCommand = &cli.Command{
|
||||
app.Env[k] = v
|
||||
}
|
||||
|
||||
if _, exists := app.Env["STACK_NAME"]; !exists {
|
||||
app.Env["STACK_NAME"] = app.StackName()
|
||||
}
|
||||
|
||||
composeFiles, err := config.GetAppComposeFiles(app.Type, app.Env)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
deployOpts := stack.Deploy{
|
||||
Composefiles: composeFiles,
|
||||
Namespace: app.Env["STACK_NAME"],
|
||||
Namespace: app.StackName(),
|
||||
Prune: false,
|
||||
ResolveImage: stack.ResolveImageAlways,
|
||||
}
|
||||
|
@ -88,10 +88,6 @@ can take some time.
|
||||
tableRow = []string{app.Server, app.Type, app.Domain}
|
||||
if status {
|
||||
stackName := app.StackName()
|
||||
if app.Env["STACK_NAME"] != "" {
|
||||
stackName = app.Env["STACK_NAME"]
|
||||
}
|
||||
|
||||
status := "unknown"
|
||||
version := "unknown"
|
||||
if statusMeta, ok := statuses[stackName]; ok {
|
||||
|
@ -27,12 +27,8 @@ var appPsCommand = &cli.Command{
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if _, exists := app.Env["STACK_NAME"]; !exists {
|
||||
app.Env["STACK_NAME"] = app.StackName()
|
||||
}
|
||||
|
||||
filters := filters.NewArgs()
|
||||
filters.Add("name", app.Env["STACK_NAME"])
|
||||
filters.Add("name", app.StackName())
|
||||
|
||||
containers, err := cl.ContainerList(c.Context, types.ContainerListOptions{Filters: filters})
|
||||
if err != nil {
|
||||
|
@ -46,6 +46,9 @@ type App struct {
|
||||
|
||||
// StackName gets what the docker safe stack name is for the app
|
||||
func (a App) StackName() string {
|
||||
if a.Env["STACK_NAME"] != "" {
|
||||
return a.Env["STACK_NAME"]
|
||||
}
|
||||
return SanitiseAppName(a.Name)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user