Add password parameter
This commit is contained in:
parent
a615cb9194
commit
8cb40303dc
|
@ -31,6 +31,7 @@ func init() {
|
|||
rootCmd.AddCommand(serverCmd)
|
||||
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().String("password", "", "Password for accessing the chat server")
|
||||
}
|
||||
|
||||
func setServerParameters(cmd *cobra.Command) error {
|
||||
|
@ -49,5 +50,12 @@ func setServerParameters(cmd *cobra.Command) error {
|
|||
logLocation = parameterHistory
|
||||
isLogging = true
|
||||
}
|
||||
parPassword, err := cmd.Flags().GetString("password")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if parPassword != "" {
|
||||
password = parPassword
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue