Skip to content

Commit

Permalink
Dynamic Configuration Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored and traefiker committed Nov 14, 2018
1 parent d3ae88f commit a09dfa3
Show file tree
Hide file tree
Showing 452 changed files with 20,966 additions and 9,362 deletions.
33 changes: 25 additions & 8 deletions .golangci.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[run]
deadline = "5m"

skip-files = [
"^old/.*",
]

[linters-settings]

[linters-settings.govet]
Expand All @@ -13,18 +20,28 @@
suggest-new = true

[linters-settings.goconst]
min-len = 2.0
min-occurrences = 2.0
min-len = 3.0
min-occurrences = 3.0

[linters-settings.misspell]
locale = "US"

[linters]
enable-all = true
disable = [
"maligned",
"lll",
"gas",
"dupl",
"prealloc"
]
"maligned",
"lll",
"gas",
"dupl",
"prealloc",
]

[issues]
max-per-linter = 0
max-same = 0
exclude = [
"(.+) is deprecated:",
"cyclomatic complexity (\\d+) of func `\\(\\*Builder\\)\\.buildConstructor` is high", #alt/server/middleware/middlewares.go
"`logger` can be `github.com/containous/traefik/vendor/github.com/stretchr/testify/assert.TestingT`", # alt/middlewares/recovery/recovery.go:
"`fn` can be `net/http.Handler`", # alt/server/alice/chain.go
]
37 changes: 7 additions & 30 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 15 additions & 11 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
# name = "github.com/x/y"
# version = "2.4.0"

[prune]
non-go = true
go-tests = true
unused-packages = true

[[constraint]]
branch = "master"
name = "github.com/ArthurHlt/go-eureka-client"
Expand Down Expand Up @@ -60,13 +65,17 @@
branch = "master"
name = "github.com/containous/mux"

[[constraint]]
branch = "containous-fork"
name = "github.com/containous/alice"

[[constraint]]
name = "github.com/containous/staert"
version = "3.1.1"

[[constraint]]
name = "github.com/containous/traefik-extra-service-fabric"
version = "1.3.0"
#[[constraint]]
# name = "github.com/containous/traefik-extra-service-fabric"
# version = "1.3.0"

[[constraint]]
name = "github.com/coreos/go-systemd"
Expand Down Expand Up @@ -111,9 +120,9 @@
name = "github.com/influxdata/influxdb"
version = "1.3.7"

[[constraint]]
branch = "master"
name = "github.com/jjcollinge/servicefabric"
#[[constraint]]
# branch = "master"
# name = "github.com/jjcollinge/servicefabric"

[[constraint]]
branch = "master"
Expand Down Expand Up @@ -252,11 +261,6 @@
branch = "master"
name = "github.com/miekg/dns"

[prune]
non-go = true
go-tests = true
unused-packages = true

[[constraint]]
name = "github.com/patrickmn/go-cache"
version = "2.1.0"
Expand Down
4 changes: 2 additions & 2 deletions acme/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"time"

"github.com/containous/traefik/log"
acmeprovider "github.com/containous/traefik/provider/acme"
"github.com/containous/traefik/types"
acmeprovider "github.com/containous/traefik/old/provider/acme"
"github.com/containous/traefik/old/types"
"github.com/xenolf/lego/acme"
)

Expand Down
11 changes: 4 additions & 7 deletions acme/acme.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ import (
"github.com/containous/staert"
"github.com/containous/traefik/cluster"
"github.com/containous/traefik/log"
acmeprovider "github.com/containous/traefik/provider/acme"
acmeprovider "github.com/containous/traefik/old/provider/acme"
"github.com/containous/traefik/old/types"
"github.com/containous/traefik/safe"
"github.com/containous/traefik/types"
"github.com/containous/traefik/version"
"github.com/eapache/channels"
"github.com/sirupsen/logrus"
"github.com/xenolf/lego/acme"
legolog "github.com/xenolf/lego/log"
"github.com/xenolf/lego/providers/dns"
Expand All @@ -53,8 +52,6 @@ type ACME struct {
DNSChallenge *acmeprovider.DNSChallenge `description:"Activate DNS-01 Challenge"`
HTTPChallenge *acmeprovider.HTTPChallenge `description:"Activate HTTP-01 Challenge"`
TLSChallenge *acmeprovider.TLSChallenge `description:"Activate TLS-ALPN-01 Challenge"`
DNSProvider string `description:"(Deprecated) Activate DNS-01 Challenge"` // Deprecated
DelayDontCheckDNS flaeg.Duration `description:"(Deprecated) Assume DNS propagates after a delay in seconds rather than finding and querying nameservers."` // Deprecated
ACMELogging bool `description:"Enable debug logging of ACME actions."`
OverrideCertificates bool `description:"Enable to override certificates in key-value store when using storeconfig"`
client *acme.Client
Expand All @@ -73,7 +70,7 @@ func (a *ACME) init() error {
acme.UserAgent = fmt.Sprintf("containous-traefik/%s", version.Version)

if a.ACMELogging {
legolog.Logger = fmtlog.New(log.WriterLevel(logrus.InfoLevel), "legolog: ", 0)
legolog.Logger = log.WithoutContext()
} else {
legolog.Logger = fmtlog.New(ioutil.Discard, "", 0)
}
Expand Down Expand Up @@ -744,7 +741,7 @@ func (a *ACME) getValidDomains(domains []string, wildcardAllowed bool) ([]string
return nil, fmt.Errorf("unable to generate a wildcard certificate for domain %q from a 'Host' rule", strings.Join(domains, ","))
}

if a.DNSChallenge == nil && len(a.DNSProvider) == 0 {
if a.DNSChallenge == nil {
return nil, fmt.Errorf("unable to generate a wildcard certificate for domain %q : ACME needs a DNSChallenge", strings.Join(domains, ","))
}
if strings.HasPrefix(domains[0], "*.*") {
Expand Down
4 changes: 2 additions & 2 deletions acme/acme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"testing"
"time"

acmeprovider "github.com/containous/traefik/provider/acme"
acmeprovider "github.com/containous/traefik/old/provider/acme"
"github.com/containous/traefik/old/types"
"github.com/containous/traefik/tls/generate"
"github.com/containous/traefik/types"
"github.com/stretchr/testify/assert"
"github.com/xenolf/lego/acme"
)
Expand Down
2 changes: 1 addition & 1 deletion acme/localStore.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"

"github.com/containous/traefik/log"
"github.com/containous/traefik/provider/acme"
"github.com/containous/traefik/old/provider/acme"
)

// LocalStore is a store using a file as storage
Expand Down
59 changes: 29 additions & 30 deletions anonymize/anonymize_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ import (

"github.com/containous/flaeg/parse"
"github.com/containous/traefik/acme"
"github.com/containous/traefik/api"
"github.com/containous/traefik/configuration"
"github.com/containous/traefik/middlewares"
"github.com/containous/traefik/provider"
acmeprovider "github.com/containous/traefik/provider/acme"
"github.com/containous/traefik/provider/boltdb"
"github.com/containous/traefik/provider/consul"
"github.com/containous/traefik/provider/consulcatalog"
"github.com/containous/traefik/provider/docker"
"github.com/containous/traefik/provider/dynamodb"
"github.com/containous/traefik/provider/ecs"
"github.com/containous/traefik/provider/etcd"
"github.com/containous/traefik/provider/eureka"
"github.com/containous/traefik/provider/file"
"github.com/containous/traefik/provider/kubernetes"
"github.com/containous/traefik/provider/kv"
"github.com/containous/traefik/provider/marathon"
"github.com/containous/traefik/provider/mesos"
"github.com/containous/traefik/provider/rancher"
"github.com/containous/traefik/provider/zk"
"github.com/containous/traefik/old/api"
"github.com/containous/traefik/old/configuration"
"github.com/containous/traefik/old/middlewares"
"github.com/containous/traefik/old/provider"
acmeprovider "github.com/containous/traefik/old/provider/acme"
"github.com/containous/traefik/old/provider/boltdb"
"github.com/containous/traefik/old/provider/consul"
"github.com/containous/traefik/old/provider/consulcatalog"
"github.com/containous/traefik/old/provider/docker"
"github.com/containous/traefik/old/provider/dynamodb"
"github.com/containous/traefik/old/provider/ecs"
"github.com/containous/traefik/old/provider/etcd"
"github.com/containous/traefik/old/provider/eureka"
"github.com/containous/traefik/old/provider/file"
"github.com/containous/traefik/old/provider/kubernetes"
"github.com/containous/traefik/old/provider/kv"
"github.com/containous/traefik/old/provider/marathon"
"github.com/containous/traefik/old/provider/mesos"
"github.com/containous/traefik/old/provider/rancher"
"github.com/containous/traefik/old/provider/zk"
"github.com/containous/traefik/old/types"
"github.com/containous/traefik/safe"
traefiktls "github.com/containous/traefik/tls"
"github.com/containous/traefik/types"
"github.com/elazarl/go-bindata-assetfs"
"github.com/thoas/stats"
)
Expand Down Expand Up @@ -173,15 +173,14 @@ func TestDo_globalConfiguration(t *testing.T) {
SANs: []string{"Domains acme SANs 1", "Domains acme SANs 2", "Domains acme SANs 3"},
},
},
Storage: "Storage",
StorageFile: "StorageFile",
OnDemand: true,
OnHostRule: true,
CAServer: "CAServer",
EntryPoint: "EntryPoint",
DNSChallenge: &acmeprovider.DNSChallenge{Provider: "DNSProvider"},
DelayDontCheckDNS: 666,
ACMELogging: true,
Storage: "Storage",
StorageFile: "StorageFile",
OnDemand: true,
OnHostRule: true,
CAServer: "CAServer",
EntryPoint: "EntryPoint",
DNSChallenge: &acmeprovider.DNSChallenge{Provider: "DNSProvider"},
ACMELogging: true,
TLSConfig: &tls.Config{
InsecureSkipVerify: true,
// ...
Expand Down
6 changes: 3 additions & 3 deletions api/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ type DashboardHandler struct {
Assets *assetfs.AssetFS
}

// AddRoutes add dashboard routes on a router
func (g DashboardHandler) AddRoutes(router *mux.Router) {
// Append add dashboard routes on a router
func (g DashboardHandler) Append(router *mux.Router) {
if g.Assets == nil {
log.Error("No assets for dashboard")
log.WithoutContext().Error("No assets for dashboard")
return
}

Expand Down
7 changes: 4 additions & 3 deletions api/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
)

func init() {
expvar.Publish("Goroutines", expvar.Func(goroutines))
// FIXME Goroutines2 -> Goroutines
expvar.Publish("Goroutines2", expvar.Func(goroutines))
}

func goroutines() interface{} {
Expand All @@ -21,8 +22,8 @@ func goroutines() interface{} {
// DebugHandler expose debug routes
type DebugHandler struct{}

// AddRoutes add debug routes on a router
func (g DebugHandler) AddRoutes(router *mux.Router) {
// Append add debug routes on a router
func (g DebugHandler) Append(router *mux.Router) {
router.Methods(http.MethodGet).Path("/debug/vars").
HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
Expand Down

0 comments on commit a09dfa3

Please sign in to comment.