Ei kuvausta
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

auth_config.go 514B

12345678910111213141516171819202122232425262728
  1. package subconfigs
  2. // AuthConfig 认证配置
  3. type AuthConfig struct {
  4. BaseConfig
  5. Token string `yaml:"token"`
  6. }
  7. func NewAuthConfig() *AuthConfig {
  8. return &AuthConfig{}
  9. }
  10. func (c *AuthConfig) SetDefaults() {
  11. // 默认不设置token
  12. }
  13. func (c *AuthConfig) Load(data map[string]interface{}) error {
  14. return c.LoadFromYAML(data, c)
  15. }
  16. func (c *AuthConfig) Validate() error {
  17. // token 可以为空,有些环境不需要认证
  18. return nil
  19. }
  20. func (c *AuthConfig) IsConfigured() bool {
  21. return c.Token != ""
  22. }