Skip to content

Commit

Permalink
Revert "Adding support for multiple compose files using env vars Civi…
Browse files Browse the repository at this point in the history
…cActions#90"

This reverts commit 9a21b51.
  • Loading branch information
David Numan committed Nov 11, 2020
1 parent 2579fa6 commit 0997042
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 70 deletions.
1 change: 0 additions & 1 deletion activate
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ eval "$(docker run --rm --privileged \
-v //var/run/docker.sock:/var/run/docker.sock \
-v "$(cygpath -w "$(pwd)" 2> /dev/null || pwd)":/src \
-e COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME:-${PWD##*/}}" \
-e BOWLINE_COMPOSE_FILE -e COMPOSE_FILE \
-e DOCKER_API_VERSION "civicactions/bowline$BOWLINE_IMAGE_SUFFIX" "$0" "$@")"
30 changes: 2 additions & 28 deletions cmd/bowline/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,13 @@ package main
import (
"fmt"
"os"
"path/filepath"
"strings"

"github.com/CivicActions/bowline/pkg/exposedcmd"
)

func parseComposeFilesEnv() (string, []string) {
envBCF := os.Getenv("BOWLINE_COMPOSE_FILE")
envCF := os.Getenv("COMPOSE_FILE")

// Default if no env vars
var composeFileString string

switch {
case envBCF != "":
// BOWLINE_COMPOSE_FILE is the preferred env var
composeFileString = envBCF
case envCF != "":
// Use COMPOSE_FILE as second choice
composeFileString = envCF
default:
// Default to the docker-compose default
composeFileString = "docker-compose.yml"
}

composeFiles := filepath.SplitList(composeFileString)
return composeFileString, composeFiles
}

func main() {
composeFileString, composeFiles := parseComposeFilesEnv()
fmt.Println("# composeFiles: ", composeFiles)

composeFiles := []string{"docker-compose.yml"}
composeProjectName := os.Getenv("COMPOSE_PROJECT_NAME")
if composeProjectName == "" {
fmt.Printf("echo -e 'Error getting composer project name: ensure COMPOSE_PROJECT_NAME is set'")
Expand All @@ -47,7 +21,7 @@ func main() {
os.Exit(1)
}
for alias, command := range commands {
fmt.Printf("alias %s='COMPOSE_FILE=\"%s\" %s'\n", alias, composeFileString, command)
fmt.Printf("alias %s='%s'\n", alias, command)
}
fmt.Println("export BOWLINE_ACTIVATED=1")
// Print some info to user.
Expand Down
41 changes: 0 additions & 41 deletions cmd/bowline/main_test.go

This file was deleted.

0 comments on commit 0997042

Please sign in to comment.