Security Update #6
|
@ -31,6 +31,7 @@ func init() {
|
||||||
rootCmd.AddCommand(serverCmd)
|
rootCmd.AddCommand(serverCmd)
|
||||||
serverCmd.PersistentFlags().StringP("port", "p", "1302", "port to use for listening")
|
serverCmd.PersistentFlags().StringP("port", "p", "1302", "port to use for listening")
|
||||||
serverCmd.PersistentFlags().StringP("history", "r", "", "File to store and recover chat history from")
|
serverCmd.PersistentFlags().StringP("history", "r", "", "File to store and recover chat history from")
|
||||||
|
serverCmd.PersistentFlags().String("password", "", "Password for accessing the chat server")
|
||||||
}
|
}
|
||||||
|
|
||||||
func setServerParameters(cmd *cobra.Command) error {
|
func setServerParameters(cmd *cobra.Command) error {
|
||||||
|
@ -49,5 +50,12 @@ func setServerParameters(cmd *cobra.Command) error {
|
||||||
logLocation = parameterHistory
|
logLocation = parameterHistory
|
||||||
isLogging = true
|
isLogging = true
|
||||||
}
|
}
|
||||||
|
parPassword, err := cmd.Flags().GetString("password")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if parPassword != "" {
|
||||||
|
password = parPassword
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue