yamldef.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package main
  2. type FrontendConfigYAML struct {
  3. CommonConfig CommonConfigYAML `yaml:"common"`
  4. LogConfig LogConfigYAML `yaml:"log"`
  5. }
  6. type CommonConfigYAML struct {
  7. IsDebugModeOn bool `yaml:"debug"`
  8. RedirectWhen404 bool `yaml:"redirect_when_404"`
  9. RedirectURL string `yaml:"redirect_url"`
  10. IsBackendProxyEnable bool `yaml:"backend_proxy_enable"`
  11. UseGZip bool `yaml:"enable_gzip"`
  12. VueHistoryMode bool `yaml:"vue_history_mode"`
  13. }
  14. type LogConfigYAML struct {
  15. AccessLogEnable bool `yaml:"access_log_enable"`
  16. RollingLogConfig RollingLoggerConfigYAML `yaml:"rolling_log_config"`
  17. AccessLoggerDetailConfig AccessLoggerConfigYAML `yaml:"access_log_config"`
  18. ErrorLoggerDetailConfig ErrorLoggerConfigYAML `yaml:"error_log_config"`
  19. }
  20. type RollingLoggerConfigYAML struct {
  21. ErrLogCfg LumberjackLoggerYAML `yaml:"error_log"`
  22. AccessLogCfg LumberjackLoggerYAML `yaml:"access_log"`
  23. }
  24. type LumberjackLoggerYAML struct {
  25. FileName string `yaml:"file"`
  26. MaxSize int `yaml:"max_size"`
  27. MaxAge int `yaml:"max_age"`
  28. MaxBackups int `yaml:"max_backups"`
  29. UseLocalTime bool `yaml:"use_local_time"`
  30. Compress bool `yaml:"compress_history"`
  31. }
  32. type AccessLoggerConfigYAML struct {
  33. OutputLevel string `yaml:"output_level"`
  34. SuccessLevel string `yaml:"success_level"`
  35. NotFoundLevel string `yaml:"not_found_level"`
  36. ForbiddenLevel string `yaml:"forbidden_level"`
  37. GatewayErrorLevel string `yaml:"gateway_error_level"`
  38. InternalErrorLevel string `yaml:"internal_error_level"`
  39. OtherStatusLevel string `yaml:"other_status_level"`
  40. LogFormat string `yaml:"log_format"`
  41. UseUTC bool `yame:"use_utc"`
  42. }
  43. type ErrorLoggerConfigYAML struct {
  44. OutputLevel string `yaml:"output_level"`
  45. LogFormat string `yaml:"log_format"`
  46. UseUTC bool `yame:"use_utc"`
  47. }