Skip to content

Commit fa17c18

Browse files
committed
Upgraded to Echo v4
Signed-off-by: Vishal Rana <[email protected]>
1 parent 40c3a61 commit fa17c18

23 files changed

+151
-125
lines changed

_fixture/config/1.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ hosts:
99
targets:
1010
- name: cloud
1111
url: http://localhost:9090
12-

admin/admin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package admin
33
import (
44
"github.com/labstack/armor"
55
"github.com/labstack/armor/admin/api"
6-
"github.com/labstack/echo"
6+
"github.com/labstack/echo/v4"
77
)
88

99
func loadPlugins(a *armor.Armor) (err error) {

admin/api/api.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package api
33
import (
44
"github.com/labstack/armor"
55
"github.com/labstack/armor/store"
6-
"github.com/labstack/echo"
6+
"github.com/labstack/echo/v4"
77
)
88

99
type (

admin/api/node.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package api
33
import (
44
"net/http"
55

6-
"github.com/labstack/echo"
6+
"github.com/labstack/echo/v4"
77
)
88

99
type (

admin/api/plugin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/labstack/armor/plugin"
1010
"github.com/labstack/armor/store"
1111
"github.com/labstack/armor/util"
12-
"github.com/labstack/echo"
12+
"github.com/labstack/echo/v4"
1313
)
1414

1515
func decodePath(c echo.Context) string {

armor.go

+7-12
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/labstack/armor/plugin"
1111
"github.com/labstack/armor/store"
1212
"github.com/labstack/armor/util"
13-
"github.com/labstack/echo"
13+
"github.com/labstack/echo/v4"
1414
"github.com/labstack/gommon/color"
1515
"github.com/labstack/gommon/log"
1616
)
@@ -76,7 +76,7 @@ type (
7676
RawPlugins []plugin.RawPlugin `json:"plugins"`
7777
Paths Paths `json:"paths"`
7878
Plugins []plugin.Plugin `json:"-"`
79-
Echo *echo.Echo `json:"-"`
79+
Group *echo.Group `json:"-"`
8080
ClientCAs []string `json:"client_ca"`
8181
TLSConfig *tls.Config `json:"-"`
8282
}
@@ -119,9 +119,8 @@ func (a *Armor) FindHost(name string, add bool) (h *Host) {
119119
// Initialize host
120120
if !h.initialized {
121121
h.Paths = make(Paths)
122-
h.Echo = echo.New()
122+
h.Group = a.Echo.Host(name)
123123
h.Name = name
124-
h.Echo.Logger = a.Logger
125124
h.initialized = true
126125
}
127126

@@ -162,7 +161,7 @@ func (a *Armor) LoadPlugin(p *store.Plugin, update bool) {
162161
} else if p.Host != "" && p.Path == "" {
163162
// Host level
164163
host := a.FindHost(p.Host, true)
165-
p := plugin.Decode(p.Raw, host.Echo, a.Logger)
164+
p := plugin.Decode(p.Raw, a.Echo, a.Logger)
166165
p.Initialize()
167166
if update {
168167
host.UpdatePlugin(p)
@@ -173,7 +172,7 @@ func (a *Armor) LoadPlugin(p *store.Plugin, update bool) {
173172
// Path level
174173
host := a.FindHost(p.Host, true)
175174
path := host.FindPath(p.Path)
176-
p := plugin.Decode(p.Raw, host.Echo, a.Logger)
175+
p := plugin.Decode(p.Raw, a.Echo, a.Logger)
177176
p.Initialize()
178177
if update {
179178
path.UpdatePlugin(p)
@@ -251,7 +250,7 @@ func (h *Host) FindPath(name string) (p *Path) {
251250
// Initialize path
252251
if !p.initialized {
253252
p.Name = name
254-
p.Group = h.Echo.Group(name)
253+
p.Group = h.Group.Group(name)
255254
p.initialized = true
256255
}
257256

@@ -261,11 +260,7 @@ func (h *Host) FindPath(name string) (p *Path) {
261260
func (h *Host) AddPlugin(p plugin.Plugin) {
262261
h.mutex.Lock()
263262
defer h.mutex.Unlock()
264-
if p.Priority() < 0 {
265-
h.Echo.Pre(p.Process)
266-
} else {
267-
h.Echo.Use(p.Process)
268-
}
263+
h.Group.Use(p.Process)
269264
h.Plugins = append(h.Plugins, p)
270265
}
271266

go.mod

+14-24
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,27 @@
11
module github.com/labstack/armor
22

3+
go 1.12
4+
35
require (
46
github.com/Knetic/govaluate v3.0.0+incompatible
5-
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
67
github.com/asdine/storm v2.1.2+incompatible
7-
github.com/coreos/etcd v3.3.10+incompatible // indirect
8-
github.com/coreos/go-semver v0.2.0 // indirect
98
github.com/docker/libkv v0.2.1
109
github.com/ghodss/yaml v1.0.0
11-
github.com/go-sql-driver/mysql v1.4.1 // indirect
12-
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
13-
github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c // indirect
14-
github.com/hashicorp/go-multierror v1.0.0 // indirect
15-
github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 // indirect
10+
github.com/hashicorp/consul/api v1.1.0 // indirect
1611
github.com/hashicorp/logutils v1.0.0
17-
github.com/hashicorp/memberlist v0.1.0 // indirect
18-
github.com/hashicorp/serf v0.8.1
12+
github.com/hashicorp/serf v0.8.3
1913
github.com/jmoiron/sqlx v1.2.0
20-
github.com/labstack/echo v3.3.8+incompatible
21-
github.com/labstack/gommon v0.2.8
14+
github.com/labstack/echo v3.3.10+incompatible // indirect
15+
github.com/labstack/echo/v4 v4.1.6
16+
github.com/labstack/gommon v0.2.9
2217
github.com/labstack/tunnel-client v0.2.12
23-
github.com/lib/pq v1.0.0
24-
github.com/miekg/dns v1.0.15 // indirect
25-
github.com/mitchellh/go-homedir v1.0.0
18+
github.com/lib/pq v1.1.1
19+
github.com/mitchellh/go-homedir v1.1.0
2620
github.com/mitchellh/mapstructure v1.1.2
2721
github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec // indirect
28-
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
29-
github.com/spf13/cobra v0.0.3
30-
github.com/spf13/pflag v1.0.3 // indirect
31-
github.com/stretchr/testify v1.2.2
32-
github.com/ugorji/go/codec v0.0.0-20181120210156-7d13b37dbec6 // indirect
33-
github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4
34-
go.etcd.io/bbolt v1.3.0 // indirect
35-
golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd
36-
gopkg.in/resty.v1 v1.10.2 // indirect
22+
github.com/spf13/cobra v0.0.5
23+
github.com/stretchr/testify v1.3.0
24+
github.com/valyala/fasttemplate v1.0.1
25+
go.etcd.io/bbolt v1.3.3 // indirect
26+
golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56
3727
)

0 commit comments

Comments
 (0)