1
0
mirror of https://github.com/umputun/reproxy.git synced 2025-11-23 22:04:57 +02:00

change docker default and add autoapi param #20

This commit is contained in:
Umputun
2021-04-12 02:57:13 -05:00
parent 1ac2f23504
commit a20abd0140
3 changed files with 70 additions and 3 deletions

View File

@@ -26,6 +26,7 @@ type Docker struct {
DockerClient DockerClient
Excludes []string
Network string
AutoAPI bool
}
// DockerClient defines interface listing containers and subscribing to events
@@ -71,7 +72,10 @@ func (d *Docker) List() ([]discovery.URLMapper, error) {
res := make([]discovery.URLMapper, 0, len(containers))
for _, c := range containers {
srcURL := fmt.Sprintf("^/api/%s/(.*)", c.Name)
srcURL := "^/(.*)"
if d.AutoAPI {
srcURL = fmt.Sprintf("^/api/%s/(.*)", c.Name)
}
destURL := fmt.Sprintf("http://%s:%d/$1", c.IP, c.Port)
pingURL := fmt.Sprintf("http://%s:%d/ping", c.IP, c.Port)
server := "*"