server.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package settings
  2. import (
  3. "github.com/go-acme/lego/v4/lego"
  4. )
  5. type Server struct {
  6. HttpHost string `json:"http_host" protected:"true"`
  7. HttpPort string `json:"http_port" protected:"true"`
  8. RunMode string `json:"run_mode" protected:"true"`
  9. JwtSecret string `json:"jwt_secret" protected:"true"`
  10. NodeSecret string `json:"node_secret" protected:"true"`
  11. HTTPChallengePort string `json:"http_challenge_port"`
  12. Email string `json:"email" protected:"true"`
  13. Database string `json:"database" protected:"true"`
  14. StartCmd string `json:"start_cmd" protected:"true"`
  15. CADir string `json:"ca_dir" binding:"omitempty,url"`
  16. Demo bool `json:"demo" protected:"true"`
  17. PageSize int `json:"page_size" protected:"true"`
  18. GithubProxy string `json:"github_proxy" binding:"omitempty,url"`
  19. CertRenewalInterval int `json:"cert_renewal_interval" binging:"min=7,max=21"`
  20. }
  21. func (s *Server) GetCADir() string {
  22. if s.Demo {
  23. return lego.LEDirectoryStaging
  24. }
  25. if s.CADir != "" {
  26. return s.CADir
  27. }
  28. return lego.LEDirectoryProduction
  29. }
  30. var ServerSettings = Server{
  31. HttpHost: "0.0.0.0",
  32. HttpPort: "9000",
  33. RunMode: "debug",
  34. HTTPChallengePort: "9180",
  35. Database: "database",
  36. StartCmd: "login",
  37. Demo: false,
  38. PageSize: 10,
  39. CADir: "",
  40. GithubProxy: "",
  41. CertRenewalInterval: 7,
  42. }