Clean up public-facing default value for config file

This commit is contained in:
Finn 2021-02-02 16:13:42 -08:00
parent 13143c756c
commit 8b8c819413
2 changed files with 6 additions and 2 deletions

View file

@ -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 ../

View file

@ -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)