diff --git a/README.md b/README.md index 54ce293..5252121 100644 --- a/README.md +++ b/README.md @@ -50,12 +50,13 @@ Available Commands: version Shows Wodby CLI version Flags: - --api-key string API key - --api-prefix string API prefix (default "api/v2") - --api-proto string API protocol (default "https") - --dind Docker in docker mode (for init) - -h, --help help for wodby - -v, --verbose Verbose output + --api-key string API key + --api-prefix string API prefix (default "api/v2") + --api-proto string API protocol (default "https") + --ci-config-path string Path to CI config (defaut "/tmp/.wodby-ci.json") + --dind Docker in docker mode (for init) + -h, --help Help for wodby + -v, --verbose Verbose output Use "wodby [command] --help" for more information about a command. ``` diff --git a/cmd/wodby/ci/build/build.go b/cmd/wodby/ci/build/build.go index 443bd48..3dde9cc 100644 --- a/cmd/wodby/ci/build/build.go +++ b/cmd/wodby/ci/build/build.go @@ -56,7 +56,7 @@ var Cmd = &cobra.Command{ PreRunE: func(cmd *cobra.Command, args []string) error { opts.services = args - v.SetConfigFile(path.Join("/tmp/.wodby-ci.json")) + v.SetConfigFile(path.Join(viper.GetString("ci_config_path"))) err := v.ReadInConfig() if err != nil { diff --git a/cmd/wodby/ci/deploy/deploy.go b/cmd/wodby/ci/deploy/deploy.go index ce42888..a2cdfde 100644 --- a/cmd/wodby/ci/deploy/deploy.go +++ b/cmd/wodby/ci/deploy/deploy.go @@ -38,7 +38,7 @@ var Cmd = &cobra.Command{ PreRunE: func(cmd *cobra.Command, args []string) error { opts.services = args - v.SetConfigFile(path.Join("/tmp/.wodby-ci.json")) + v.SetConfigFile(path.Join(viper.GetString("ci_config_path"))) err := v.ReadInConfig() if err != nil { diff --git a/cmd/wodby/ci/initialize/initialize.go b/cmd/wodby/ci/initialize/initialize.go index 535d153..207bf3a 100644 --- a/cmd/wodby/ci/initialize/initialize.go +++ b/cmd/wodby/ci/initialize/initialize.go @@ -178,7 +178,7 @@ var Cmd = &cobra.Command{ return err } - err = ioutil.WriteFile(path.Join("/tmp/.wodby-ci.json"), content, 0600) + err = ioutil.WriteFile(path.Join(viper.GetString("ci_config_path")), content, 0600) if err != nil { return err } diff --git a/cmd/wodby/ci/release/release.go b/cmd/wodby/ci/release/release.go index db7380f..ddacccf 100644 --- a/cmd/wodby/ci/release/release.go +++ b/cmd/wodby/ci/release/release.go @@ -34,7 +34,7 @@ var Cmd = &cobra.Command{ PreRunE: func(cmd *cobra.Command, args []string) error { opts.services = args - v.SetConfigFile(path.Join("/tmp/.wodby-ci.json")) + v.SetConfigFile(path.Join(viper.GetString("ci_config_path"))) err := v.ReadInConfig() if err != nil { diff --git a/cmd/wodby/ci/run/run.go b/cmd/wodby/ci/run/run.go index 54a526d..f11c2e8 100644 --- a/cmd/wodby/ci/run/run.go +++ b/cmd/wodby/ci/run/run.go @@ -19,7 +19,7 @@ type options struct { env []string user string entrypoint string - path string + path string } var opts options @@ -28,9 +28,9 @@ var v = viper.New() var Cmd = &cobra.Command{ Use: "run", Short: "Run container", - Args: cobra.MinimumNArgs(1), + Args: cobra.MinimumNArgs(1), PreRunE: func(cmd *cobra.Command, args []string) error { - v.SetConfigFile(path.Join( "/tmp/.wodby-ci.json")) + v.SetConfigFile(path.Join(viper.GetString("ci_config_path"))) err := v.ReadInConfig() if err != nil { diff --git a/cmd/wodby/main.go b/cmd/wodby/main.go index 7b72d00..8051f37 100644 --- a/cmd/wodby/main.go +++ b/cmd/wodby/main.go @@ -30,6 +30,9 @@ func init() { RootCmd.PersistentFlags().String("api-prefix", "api/v2", "API prefix") viper.BindPFlag("api_prefix", RootCmd.PersistentFlags().Lookup("api-prefix")) + RootCmd.PersistentFlags().String("ci-config-path", "/tmp/.wodby-ci.json", "CI config path") + viper.BindPFlag("ci_config_path", RootCmd.PersistentFlags().Lookup("ci-config-path")) + RootCmd.PersistentFlags().Bool("verbose", false, "Verbose output") viper.BindPFlag("verbose", RootCmd.PersistentFlags().Lookup("verbose"))