From 8b8c8194135342b3a173a4268282f66042da5ca1 Mon Sep 17 00:00:00 2001 From: Finn Date: Tue, 2 Feb 2021 16:13:42 -0800 Subject: [PATCH] Clean up public-facing default value for config file --- .gitlab-ci.yml | 2 +- cmd/signaldctl/cmd/root.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 11602cf..6b78f02 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -95,7 +95,7 @@ pages: before_script: - apt-get update && apt-get install -y hugo script: - - ./signaldctl doc + - SIGNALDCTL_PUBLIC_DOC_MODE=on ./signaldctl doc - cd docs - hugo - mv public ../ diff --git a/cmd/signaldctl/cmd/root.go b/cmd/signaldctl/cmd/root.go index 54c916d..05b38dd 100644 --- a/cmd/signaldctl/cmd/root.go +++ b/cmd/signaldctl/cmd/root.go @@ -66,7 +66,11 @@ func Execute() { func init() { cobra.OnInitialize(initConfig) - RootCmd.PersistentFlags().StringVar(&config.Path, "config", fmt.Sprintf("%s/.config/signaldctl.yaml", os.Getenv("HOME")), "config file (default is ~/.config/signaldctl.yaml)") + defaultConfigPath := fmt.Sprintf("%s/.config/signaldctl.yaml", os.Getenv("HOME")) + if os.Getenv("SIGNALDCTL_PUBLIC_DOC_MODE") == "on" { + defaultConfigPath = "~/.config/signaldctl.yaml" + } + RootCmd.PersistentFlags().StringVar(&config.Path, "config", defaultConfigPath, "config file") RootCmd.PersistentFlags().StringVar(&socketPath, "socket", "/var/run/signald/signald.sock", "the path to the signald socket file") RootCmd.PersistentFlags().StringVarP(&common.OutputFormat, "output-format", "o", "default", "the output format. options are usually table, yaml and json, default is usually table. Some commands have other options.") RootCmd.AddCommand(account.AccountCmd)