Skip to content

Commit

Permalink
make config gen command visible
Browse files Browse the repository at this point in the history
Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>
  • Loading branch information
vivek-yadav committed Jul 19, 2023
1 parent eb0341f commit e0d72e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions components/automate-cli/cmd/chef-automate/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,13 @@ var showConfigCmd = &cobra.Command{

var genConfigCmd = &cobra.Command{
Use: "gen [/path/to/write/config.toml]",
Short: "generate the Chef Automate or Automate HA configuration",
Short: "generate the Automate HA configuration",
Long: "Prompt based Config Generation command. It will output the config in the provided file, if file path is not provided then it will print on STDOUT.",
RunE: runGenCmd,
Args: cobra.RangeArgs(0, 2),
Annotations: map[string]string{
docs.Tag: docs.BastionHost,
},
Hidden: true,
}

var patchConfigCmd = &cobra.Command{
Expand Down
7 changes: 6 additions & 1 deletion lib/io/fileutils/fileutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ func WriteToFile(filepath string, data []byte) error {
}

func ReadFile(filename string) ([]byte, error) {
return os.ReadFile(filename)
home := os.Getenv("HOME")
path := filename
if strings.Index(path, "~") == 0 {
path = strings.Replace(path, "~", home, 1)
}
return os.ReadFile(path)
}

func WriteFile(filepath string, data []byte, perm os.FileMode) error {
Expand Down

0 comments on commit e0d72e5

Please sign in to comment.