messages.go 571 B

12345678910111213141516171819202122232425262728
  1. package main
  2. import (
  3. "fmt"
  4. "runtime"
  5. )
  6. const (
  7. ReloadMessageFormat = `Run '%s' for the new configuration to be effective.`
  8. ReloadCmdLinux = `sudo systemctl reload crowdsec`
  9. ReloadCmdFreebsd = `sudo service crowdsec reload`
  10. )
  11. func ReloadMessage() string {
  12. var reloadCmd string
  13. switch runtime.GOOS {
  14. case "windows":
  15. return "Please restart the crowdsec service for the new configuration to be effective."
  16. case "freebsd":
  17. reloadCmd = ReloadCmdFreebsd
  18. default:
  19. reloadCmd = ReloadCmdLinux
  20. }
  21. return fmt.Sprintf(ReloadMessageFormat, reloadCmd)
  22. }