Security Update #6

Merged
raul merged 25 commits from testing into main 2024-05-17 08:00:14 +02:00
1 changed files with 8 additions and 0 deletions
Showing only changes of commit 8cb40303dc - Show all commits

View File

@ -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
} }