Fix commands.
Add username to config struct, if present execute `sudo -E -u username` in command
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/Masterminds/semver"
|
||||
"github.com/urfave/cli/v2"
|
||||
"gopkg.in/yaml.v3"
|
||||
"io/ioutil"
|
||||
"ledo/app/modules/context"
|
||||
@ -147,9 +148,13 @@ func ExecComposerDebug(ctx *context.LedoContext) {
|
||||
ctx.ExecCmd("docker-compose", args[0:])
|
||||
}
|
||||
|
||||
func ExecComposerRun(ctx *context.LedoContext) {
|
||||
func ExecComposerRun(ctx *context.LedoContext, command cli.Args) {
|
||||
args := ctx.ComposeArgs
|
||||
args = append(args, "run", strings.ToLower(ctx.Config.Docker.MainService), ctx.Config.Docker.Shell)
|
||||
args = append(args, "run", strings.ToLower(ctx.Config.Docker.MainService))
|
||||
if ctx.Config.Docker.Username != "" {
|
||||
args = append(args, "sudo", "-E", "-u", ctx.Config.Docker.Username)
|
||||
}
|
||||
args = append(args, command.Slice()...)
|
||||
ctx.ExecCmd("docker-compose", args[0:])
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user