From bd46082cfe8ca8267ac222fd32f918a1b59c7abc Mon Sep 17 00:00:00 2001 From: Pierre-Alain TORET Date: Wed, 22 Aug 2018 09:16:44 +0200 Subject: [PATCH] Add command line option for server binding Signed-off-by: Pierre-Alain TORET --- commands/dispatch.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commands/dispatch.go b/commands/dispatch.go index 25af192a..bbe3913d 100644 --- a/commands/dispatch.go +++ b/commands/dispatch.go @@ -95,11 +95,13 @@ func init() { rootCmd.PersistentFlags().String("dir", storage.DefaultDirectory(), "directory to store config and data in") rootCmd.PersistentFlags().Bool("reset-config", false, "reset to the default configuration, overwriting the current one") + rootCmd.Flags().StringP("address", "a", "", "interface to which the server will bind") rootCmd.Flags().IntP("port", "p", 80, "port to listen on") rootCmd.Flags().Bool("dev", false, "development mode") viper.BindPFlag("dir", rootCmd.PersistentFlags().Lookup("dir")) viper.BindPFlag("reset_config", rootCmd.PersistentFlags().Lookup("reset-config")) + viper.BindPFlag("address", rootCmd.Flags().Lookup("address")) viper.BindPFlag("port", rootCmd.Flags().Lookup("port")) viper.BindPFlag("dev", rootCmd.Flags().Lookup("dev"))