mirror of
https://github.com/umputun/reproxy.git
synced 2025-02-16 18:34:30 +02:00
fix default docker dest to include container
This commit is contained in:
parent
b04832658e
commit
69bb10d42f
@ -70,7 +70,7 @@ func (d *Docker) List() ([]discovery.URLMapper, error) {
|
||||
res := make([]discovery.URLMapper, 0, len(containers))
|
||||
for _, c := range containers {
|
||||
enabled, explicit := false, false
|
||||
srcURL := "^/(.*)"
|
||||
srcURL := fmt.Sprintf("^/%s/(.*)", c.Name)
|
||||
if d.AutoAPI {
|
||||
enabled = true
|
||||
srcURL = fmt.Sprintf("^/api/%s/(.*)", c.Name)
|
||||
|
@ -59,15 +59,15 @@ func TestDocker_List(t *testing.T) {
|
||||
assert.Equal(t, "example.com", res[0].Server)
|
||||
assert.Equal(t, "http://127.0.0.2:12345/ping", res[0].PingURL)
|
||||
|
||||
assert.Equal(t, "^/a/(.*)", res[1].SrcMatch.String())
|
||||
assert.Equal(t, "http://127.0.0.2:12348/a/$1", res[1].Dst)
|
||||
assert.Equal(t, "http://127.0.0.2:12348/ping", res[1].PingURL)
|
||||
assert.Equal(t, "example.com", res[1].Server)
|
||||
assert.Equal(t, "^/c2/(.*)", res[1].SrcMatch.String())
|
||||
assert.Equal(t, "http://127.0.0.3:12346/$1", res[1].Dst)
|
||||
assert.Equal(t, "http://127.0.0.3:12346/ping", res[1].PingURL)
|
||||
assert.Equal(t, "*", res[1].Server)
|
||||
|
||||
assert.Equal(t, "^/(.*)", res[2].SrcMatch.String())
|
||||
assert.Equal(t, "http://127.0.0.3:12346/$1", res[2].Dst)
|
||||
assert.Equal(t, "http://127.0.0.3:12346/ping", res[2].PingURL)
|
||||
assert.Equal(t, "*", res[2].Server)
|
||||
assert.Equal(t, "^/a/(.*)", res[2].SrcMatch.String())
|
||||
assert.Equal(t, "http://127.0.0.2:12348/a/$1", res[2].Dst)
|
||||
assert.Equal(t, "http://127.0.0.2:12348/ping", res[2].PingURL)
|
||||
assert.Equal(t, "example.com", res[2].Server)
|
||||
}
|
||||
|
||||
func TestDocker_ListWithAutoAPI(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user