Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 9 additions & 3 deletions internal/docker/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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...)
}