Allow different docker-compose extensions
This commit is contained in:
15
main.go
15
main.go
@@ -13,11 +13,23 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ComposeFile = "docker-compose.yaml"
|
var composeFiles = []string{"docker-compose.yaml", "docker-compose.yml"}
|
||||||
|
var ComposeFile = ""
|
||||||
var AppName = "MyApp"
|
var AppName = "MyApp"
|
||||||
var Version = "master" // set at build time to the git version/tag
|
var Version = "master" // set at build time to the git version/tag
|
||||||
var ChartsDir = "chart"
|
var ChartsDir = "chart"
|
||||||
|
|
||||||
|
func findComposeFile() {
|
||||||
|
for _, file := range composeFiles {
|
||||||
|
if _, err := os.Stat(file); err == nil {
|
||||||
|
ComposeFile = file
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Printf("No compose file found in %s\n", composeFiles)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
func detectGitVersion() (string, error) {
|
func detectGitVersion() (string, error) {
|
||||||
defaulVersion := "0.0.1"
|
defaulVersion := "0.0.1"
|
||||||
// Check if .git directory exists
|
// Check if .git directory exists
|
||||||
@@ -69,6 +81,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
|
findComposeFile()
|
||||||
flag.StringVar(&ChartsDir, "chart-dir", ChartsDir, "set the chart directory")
|
flag.StringVar(&ChartsDir, "chart-dir", ChartsDir, "set the chart directory")
|
||||||
flag.StringVar(&ComposeFile, "compose", ComposeFile, "set the compose file to parse")
|
flag.StringVar(&ComposeFile, "compose", ComposeFile, "set the compose file to parse")
|
||||||
flag.StringVar(&AppName, "appname", helm.GetProjectName(), "set the helm chart app name")
|
flag.StringVar(&AppName, "appname", helm.GetProjectName(), "set the helm chart app name")
|
||||||
|
Reference in New Issue
Block a user