Fix SocketPath handling
- use config unless socket option is provided - render default path in PUBLIC_DOC_MODE
This commit is contained in:
parent
156db67aa6
commit
c3f78b9dd8
1 changed files with 3 additions and 1 deletions
|
@ -69,11 +69,13 @@ func Execute() {
|
||||||
func init() {
|
func init() {
|
||||||
cobra.OnInitialize(initConfig)
|
cobra.OnInitialize(initConfig)
|
||||||
defaultConfigPath := fmt.Sprintf("%s/.config/signaldctl.yaml", os.Getenv("HOME"))
|
defaultConfigPath := fmt.Sprintf("%s/.config/signaldctl.yaml", os.Getenv("HOME"))
|
||||||
|
defaultSocketPath := ""
|
||||||
if os.Getenv("SIGNALDCTL_PUBLIC_DOC_MODE") == "on" {
|
if os.Getenv("SIGNALDCTL_PUBLIC_DOC_MODE") == "on" {
|
||||||
defaultConfigPath = "~/.config/signaldctl.yaml"
|
defaultConfigPath = "~/.config/signaldctl.yaml"
|
||||||
|
defaultSocketPath = "/var/run/signald/signald.sock"
|
||||||
}
|
}
|
||||||
RootCmd.PersistentFlags().StringVar(&config.Path, "config", defaultConfigPath, "config file")
|
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.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(account.AccountCmd)
|
||||||
RootCmd.AddCommand(configcmd.ConfigCmd)
|
RootCmd.AddCommand(configcmd.ConfigCmd)
|
||||||
|
|
Loading…
Reference in a new issue