diff --git a/cmd/site.go b/cmd/site.go index 01cbd8f..ed1953b 100644 --- a/cmd/site.go +++ b/cmd/site.go @@ -102,10 +102,10 @@ var execCmd = &cobra.Command{ return } - // if the next argument is "php", "nginx" or "litespeed", use it as the service name + // if the next argument is "php", "nginx" or "openlitespeed", use it as the service name // otherwise, use "php" as the default service name composeArgs := []string{"exec"} - if args[0] == "php" || args[0] == "nginx" || args[0] == "litespeed" { + if args[0] == "php" || args[0] == "nginx" || args[0] == "openlitespeed" { composeArgs = append(composeArgs, args[0]) args = args[1:] } else { diff --git a/internal/docker/compose.go b/internal/docker/compose.go index c9d6712..2625f0d 100644 --- a/internal/docker/compose.go +++ b/internal/docker/compose.go @@ -48,8 +48,8 @@ func getContainerName(composePath string) (string, error) { if _, exists := config.Services["php"]; exists { return "php", nil - } else if _, exists := config.Services["litespeed"]; exists { - return "litespeed", nil + } else if _, exists := config.Services["openlitespeed"]; exists { + return "openlitespeed", nil } return "", fmt.Errorf("no suitable container found") @@ -61,6 +61,12 @@ func RunWPCLI(composePath string, args []string) error { return err } - wpArgs := append([]string{"exec", containerName, "wp"}, args...) + var wpArgs []string + if containerName == "openlitespeed" { + wpArgs = append([]string{"exec", "--user", "www-data", containerName, "wp"}, args...) + } else { + wpArgs = append([]string{"exec", containerName, "wp"}, args...) + } + return RunCompose(composePath, wpArgs...) }