From c3f78b9dd861fd3bf808b6e4e12013291f642d85 Mon Sep 17 00:00:00 2001 From: Sebastian Haas Date: Mon, 5 Apr 2021 21:43:07 +0200 Subject: [PATCH] Fix SocketPath handling - use config unless socket option is provided - render default path in PUBLIC_DOC_MODE --- cmd/signaldctl/cmd/root.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/signaldctl/cmd/root.go b/cmd/signaldctl/cmd/root.go index 4f75fa8..e6e5c36 100644 --- a/cmd/signaldctl/cmd/root.go +++ b/cmd/signaldctl/cmd/root.go @@ -69,11 +69,13 @@ func Execute() { func init() { cobra.OnInitialize(initConfig) defaultConfigPath := fmt.Sprintf("%s/.config/signaldctl.yaml", os.Getenv("HOME")) + defaultSocketPath := "" if os.Getenv("SIGNALDCTL_PUBLIC_DOC_MODE") == "on" { defaultConfigPath = "~/.config/signaldctl.yaml" + defaultSocketPath = "/var/run/signald/signald.sock" } 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().StringVar(&socketPath, "socket", defaultSocketPath, "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) RootCmd.AddCommand(configcmd.ConfigCmd)