-
Notifications
You must be signed in to change notification settings - Fork 1
Support for compose files with different names (as per spec) #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,12 +8,29 @@ COMPOSE_WRAPPER=/usr/local/emhttp/plugins/compose.manager/scripts/compose.sh | |
|
|
||
| for dir in $COMPOSE_ROOT/*; do | ||
| if [ -d "$dir" ]; then | ||
| if [ -f "$dir/docker-compose.yml" ] || [ -f "$dir/indirect" ]; then | ||
| # Check if any valid compose file exists | ||
| if [ -f "$dir/compose.yaml" ] || [ -f "$dir/compose.yml" ] || [ -f "$dir/docker-compose.yaml" ] || [ -f "$dir/docker-compose.yml" ] || [ -f "$dir/indirect" ]; then | ||
| name=${dir}/name | ||
| name=$(< "${name}") | ||
| # Find the compose file | ||
| compose_file="" | ||
| if [ -f "$dir/compose.yaml" ]; then | ||
| compose_file="$dir/compose.yaml" | ||
| override_file="$dir/compose.override.yml" | ||
| elif [ -f "$dir/compose.yml" ]; then | ||
| compose_file="$dir/compose.yml" | ||
| override_file="$dir/compose.override.yml" | ||
| elif [ -f "$dir/docker-compose.yaml" ]; then | ||
| compose_file="$dir/docker-compose.yaml" | ||
| override_file="$dir/docker-compose.override.yml" | ||
| elif [ -f "$dir/docker-compose.yml" ]; then | ||
| compose_file="$dir/docker-compose.yml" | ||
| override_file="$dir/docker-compose.override.yml" | ||
| fi | ||
|
|
||
| override="" | ||
| if [ -f "$dir/docker-compose.override.yml" ]; then | ||
| override="$dir/docker-compose.override.yml" | ||
| if [ -n "$compose_file" ] && [ -f "$override_file" ]; then | ||
| override="$override_file" | ||
| override="-f ${override@Q}" | ||
| fi | ||
|
Comment on lines
+15
to
35
|
||
| envpath="" | ||
|
|
@@ -28,8 +45,7 @@ for dir in $COMPOSE_ROOT/*; do | |
| indirect=$(< "${indirect}") | ||
| eval $COMPOSE_WRAPPER -c stop -d ${indirect@Q} -p "${name// /_}" $override $envpath > /dev/null & | ||
| else | ||
| dir="$dir/docker-compose.yml" | ||
| eval $COMPOSE_WRAPPER -c stop -f ${dir@Q} -p "${name// /_}" $override $envpath > /dev/null & | ||
| eval $COMPOSE_WRAPPER -c stop -f ${compose_file@Q} -p "${name// /_}" $override $envpath > /dev/null & | ||
| fi | ||
| fi | ||
| fi | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ function createComboButton($text, $id, $onClick, $onClickParams, $items) { | |
| } | ||
| $o = ""; | ||
| foreach ($composeProjects as $project) { | ||
| if ( ( ! is_file("$compose_root/$project/docker-compose.yml") ) && | ||
| if ( ( findComposeFile("$compose_root/$project") === null ) && | ||
| ( ! is_file("$compose_root/$project/indirect") ) ) { | ||
| continue; | ||
| } | ||
|
|
@@ -596,7 +596,9 @@ function editComposeFile(myID) { | |
| editor.getSession().setOptions({ tabSize: 2, useSoftTabs: true }); | ||
|
|
||
| $('#editorFileName').data("stackname", project); | ||
| $('#editorFileName').data("stackfilename", "docker-compose.yml") | ||
| // Extract the actual filename from the response | ||
| var filename = response.fileName.split('/').pop(); | ||
| $('#editorFileName').data("stackfilename", filename) | ||
| $('#editorFileName').html(response.fileName) | ||
|
||
| $(".editing").show(); | ||
| window.scrollTo(0, 0); | ||
|
|
@@ -635,18 +637,14 @@ function saveEdit() { | |
| var scriptContents = editor.getValue(); | ||
| var actionStr = null | ||
|
|
||
| switch(fileName) { | ||
| case 'docker-compose.yml': | ||
| actionStr = 'saveYml' | ||
| break; | ||
|
|
||
| case '.env': | ||
| actionStr = 'saveEnv' | ||
| break; | ||
|
|
||
| default: | ||
| $(".editing").hide(); | ||
| return; | ||
| // Check if this is a compose file (any valid extension) | ||
| if (fileName.match(/^(docker-)?compose\.(yml|yaml)$/)) { | ||
| actionStr = 'saveYml' | ||
| } else if (fileName === '.env') { | ||
| actionStr = 'saveEnv' | ||
| } else { | ||
| $(".editing").hide(); | ||
| return; | ||
| } | ||
|
|
||
| $.post(caURL,{action:actionStr,script:project,scriptContents:scriptContents},function(data) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,7 +11,7 @@ function logger($string) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function execComposeCommandInTTY($cmd, $debug) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| global $socket_name;; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| global $socket_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $pid = exec("pgrep -a ttyd|awk '/\\/$socket_name\\.sock/{print \$1}'"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( $debug ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger($pid); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -61,14 +61,71 @@ function echoComposeCommand($action) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeFile = "-d$composeFile"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeFile .= "$path/docker-compose.yml"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $foundComposeFile = findComposeFile($path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($foundComposeFile === null) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeFile .= "$path/docker-compose.yml"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeFile .= $foundComposeFile; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeFile = "-f$composeFile"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeCommand[] = $composeFile; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( is_file("$path/docker-compose.override.yml") ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeOverride = "-f$path/docker-compose.override.yml"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // First, always include the plugin's override file if it exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| global $compose_root; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $projectName = basename($path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $pluginOverrideYml = "$compose_root/$projectName/docker-compose.override.yml"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $pluginOverrideYaml = "$compose_root/$projectName/docker-compose.override.yaml"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (is_file($pluginOverrideYml)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeOverride = "-f$pluginOverrideYml"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeCommand[] = $composeOverride; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( $debug ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger("Using plugin override file: $pluginOverrideYml"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (is_file($pluginOverrideYaml)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeOverride = "-f$pluginOverrideYaml"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeCommand[] = $composeOverride; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( $debug ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger("Using plugin override file: $pluginOverrideYaml"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Then, also include any project-specific override files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (isIndirect($path)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $basePath = getPath($path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $basePath = $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $foundComposeFile = findComposeFile($basePath); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($foundComposeFile !== null) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $baseFileName = getComposeFileBaseName($foundComposeFile); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Get the extension of the original compose file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $extension = pathinfo($foundComposeFile, PATHINFO_EXTENSION); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $overrideFile = "$basePath/$baseFileName.override.$extension"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (is_file($overrideFile)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeOverride = "-f$overrideFile"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeCommand[] = $composeOverride; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( $debug ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger("Using project override file: $overrideFile"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check for both yml and yaml override files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (is_file("$basePath/docker-compose.override.yml")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeOverride = "-f$basePath/docker-compose.override.yml"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeCommand[] = $composeOverride; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( $debug ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger("Using project override file: $basePath/docker-compose.override.yml"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (is_file("$basePath/docker-compose.override.yaml")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeOverride = "-f$basePath/docker-compose.override.yaml"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeCommand[] = $composeOverride; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( $debug ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger("Using project override file: $basePath/docker-compose.override.yaml"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+109
to
+126
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $composeCommand[] = $composeOverride; | |
| if ( $debug ) { | |
| logger("Using project override file: $overrideFile"); | |
| } | |
| } | |
| } else { | |
| // Check for both yml and yaml override files | |
| if (is_file("$basePath/docker-compose.override.yml")) { | |
| $composeOverride = "-f$basePath/docker-compose.override.yml"; | |
| $composeCommand[] = $composeOverride; | |
| if ( $debug ) { | |
| logger("Using project override file: $basePath/docker-compose.override.yml"); | |
| } | |
| } else if (is_file("$basePath/docker-compose.override.yaml")) { | |
| $composeOverride = "-f$basePath/docker-compose.override.yaml"; | |
| $composeCommand[] = $composeOverride; | |
| if ( $debug ) { | |
| logger("Using project override file: $basePath/docker-compose.override.yaml"); | |
| if (!in_array($composeOverride, $composeCommand, true)) { | |
| $composeCommand[] = $composeOverride; | |
| if ( $debug ) { | |
| logger("Using project override file: $overrideFile"); | |
| } | |
| } else if ( $debug ) { | |
| logger("Skipping duplicate project override file: $overrideFile"); | |
| } | |
| } | |
| } else { | |
| // Check for both yml and yaml override files | |
| if (is_file("$basePath/docker-compose.override.yml")) { | |
| $composeOverride = "-f$basePath/docker-compose.override.yml"; | |
| if (!in_array($composeOverride, $composeCommand, true)) { | |
| $composeCommand[] = $composeOverride; | |
| if ( $debug ) { | |
| logger("Using project override file: $basePath/docker-compose.override.yml"); | |
| } | |
| } else if ( $debug ) { | |
| logger("Skipping duplicate project override file: $basePath/docker-compose.override.yml"); | |
| } | |
| } else if (is_file("$basePath/docker-compose.override.yaml")) { | |
| $composeOverride = "-f$basePath/docker-compose.override.yaml"; | |
| if (!in_array($composeOverride, $composeCommand, true)) { | |
| $composeCommand[] = $composeOverride; | |
| if ( $debug ) { | |
| logger("Using project override file: $basePath/docker-compose.override.yaml"); | |
| } | |
| } else if ( $debug ) { | |
| logger("Skipping duplicate project override file: $basePath/docker-compose.override.yaml"); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -51,10 +51,13 @@ function getElement($element) { | |||||||||||||||||||||||
| #Create stack files | ||||||||||||||||||||||||
| if ( !empty($indirect) ) { | ||||||||||||||||||||||||
| file_put_contents("$folder/indirect",$indirect); | ||||||||||||||||||||||||
| if ( !is_file("$indirect/docker-compose.yml") ) { | ||||||||||||||||||||||||
| $composeFile = findComposeFile($indirect); | ||||||||||||||||||||||||
| if ($composeFile === null) { | ||||||||||||||||||||||||
| // Create default docker-compose.yml if no compose file exists | ||||||||||||||||||||||||
| file_put_contents("$indirect/docker-compose.yml","services:\n"); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||
| // Create default docker-compose.yml for new projects | ||||||||||||||||||||||||
| file_put_contents("$folder/docker-compose.yml","services:\n"); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -92,9 +95,22 @@ function getElement($element) { | |||||||||||||||||||||||
| case 'getYml': | ||||||||||||||||||||||||
| $script = isset($_POST['script']) ? urldecode(($_POST['script'])) : ""; | ||||||||||||||||||||||||
| $basePath = getPath("$compose_root/$script"); | ||||||||||||||||||||||||
| $fileName = "docker-compose.yml"; | ||||||||||||||||||||||||
| $composeFile = findComposeFile($basePath); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // If no compose file exists, use the default path | ||||||||||||||||||||||||
| if ($composeFile === null) { | ||||||||||||||||||||||||
| // Try both yaml and yml extensions | ||||||||||||||||||||||||
| if (is_file("$basePath/docker-compose.yaml")) { | ||||||||||||||||||||||||
| $fileName = "docker-compose.yaml"; | ||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||
| $fileName = "docker-compose.yml"; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
+100
to
+107
|
||||||||||||||||||||||||
| // If no compose file exists, use the default path | |
| if ($composeFile === null) { | |
| // Try both yaml and yml extensions | |
| if (is_file("$basePath/docker-compose.yaml")) { | |
| $fileName = "docker-compose.yaml"; | |
| } else { | |
| $fileName = "docker-compose.yml"; | |
| } | |
| // If no compose file exists, use a single default path | |
| if ($composeFile === null) { | |
| $fileName = "docker-compose.yml"; |
Copilot
AI
Feb 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as getYml: in saveYml, checking for docker-compose.yaml inside the ($composeFile === null) branch is dead code because findComposeFile($basePath) would have found it. Simplifying this will make the save path behavior clearer.
| // If no compose file exists, use the default path | |
| if ($composeFile === null) { | |
| // Try both yaml and yml extensions | |
| if (is_file("$basePath/docker-compose.yaml")) { | |
| $fileName = "docker-compose.yaml"; | |
| } else { | |
| $fileName = "docker-compose.yml"; | |
| } | |
| // If no compose file exists, use a default path | |
| if ($composeFile === null) { | |
| $fileName = "docker-compose.yml"; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,40 @@ | ||||||
| <?php | ||||||
|
|
||||||
| /** | ||||||
| * Find the first valid compose file in a directory following Docker Compose priority order | ||||||
| * | ||||||
| * @param string $dir Directory to search in | ||||||
| * @return string|null Path to the first valid compose file found, or null if none found | ||||||
| */ | ||||||
| function findComposeFile($dir) { | ||||||
| // Docker Compose priority order: compose.yaml, compose.yml, docker-compose.yaml, docker-compose.yml | ||||||
| $possibleFiles = [ | ||||||
| "$dir/compose.yaml", | ||||||
| "$dir/compose.yml", | ||||||
| "$dir/docker-compose.yaml", | ||||||
| "$dir/docker-compose.yml" | ||||||
| ]; | ||||||
|
|
||||||
| foreach ($possibleFiles as $file) { | ||||||
| if (file_exists($file)) { | ||||||
|
||||||
| if (file_exists($file)) { | |
| if (is_file($file)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Override selection is incorrect for
.yamlcompose files and indirect stacks. Forcompose.yaml/docker-compose.yamlthis setsoverride_fileto a.ymlname, so.override.yamlfiles won’t be picked up. Also, for indirect stacks (only$dir/indirectpresent),compose_filestays empty and the override is skipped entirely due to-n "$compose_file", which is a regression from the previousdocker-compose.override.ymlcheck. Consider: (1) deriving the override filename from the chosen compose file’s extension/base name (or checking both.ymland.yaml), and (2) allowing the plugin override in the project dir even when the stack is indirect.