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.

migrations.go 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package setting
  5. import (
  6. "strings"
  7. )
  8. var (
  9. // Migrations settings
  10. Migrations = struct {
  11. MaxAttempts int
  12. RetryBackoff int
  13. AllowedDomains []string
  14. BlockedDomains []string
  15. AllowLocalNetworks bool
  16. }{
  17. MaxAttempts: 3,
  18. RetryBackoff: 3,
  19. }
  20. )
  21. func newMigrationsService() {
  22. sec := Cfg.Section("migrations")
  23. Migrations.MaxAttempts = sec.Key("MAX_ATTEMPTS").MustInt(Migrations.MaxAttempts)
  24. Migrations.RetryBackoff = sec.Key("RETRY_BACKOFF").MustInt(Migrations.RetryBackoff)
  25. Migrations.AllowedDomains = sec.Key("ALLOWED_DOMAINS").Strings(",")
  26. for i := range Migrations.AllowedDomains {
  27. Migrations.AllowedDomains[i] = strings.ToLower(Migrations.AllowedDomains[i])
  28. }
  29. Migrations.BlockedDomains = sec.Key("BLOCKED_DOMAINS").Strings(",")
  30. for i := range Migrations.BlockedDomains {
  31. Migrations.BlockedDomains[i] = strings.ToLower(Migrations.BlockedDomains[i])
  32. }
  33. Migrations.AllowLocalNetworks = sec.Key("ALLOW_LOCALNETWORKS").MustBool(false)
  34. }