Hability to filter by protocol, tcp
gitea/docker-discover/pipeline/head This commit looks good
Details
gitea/docker-discover/pipeline/head This commit looks good
Details
This commit is contained in:
parent
c84fafb975
commit
7a91807723
|
@ -1,5 +1,5 @@
|
||||||
delay: 4
|
delay: 4
|
||||||
debug: false
|
debug: true
|
||||||
events: [service, node]
|
events: [service, node]
|
||||||
docker:
|
docker:
|
||||||
socketPath: /var/run/docker.sock
|
socketPath: /var/run/docker.sock
|
||||||
|
|
7
index.js
7
index.js
|
@ -57,9 +57,14 @@ async function updateProxy() {
|
||||||
let match = name.match(/^(.+)_main$/);
|
let match = name.match(/^(.+)_main$/);
|
||||||
if (match) name = match[1];
|
if (match) name = match[1];
|
||||||
|
|
||||||
|
let port = ports[0];
|
||||||
|
let protocol = port.Protocol;
|
||||||
|
|
||||||
services.push({
|
services.push({
|
||||||
name,
|
name,
|
||||||
port: ports[0].PublishedPort
|
port: port.PublishedPort,
|
||||||
|
protocol,
|
||||||
|
tcp: protocol == 'tcp'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
services = services.sort(sortFn);
|
services = services.sort(sortFn);
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
# Auto-generated backends
|
# Auto-generated backends
|
||||||
|
|
||||||
{{#each services}}
|
{{#each services}}
|
||||||
|
{{#if tcp}}
|
||||||
backend {{name}}
|
backend {{name}}
|
||||||
{{#each ../nodes}}
|
{{#each ../nodes}}
|
||||||
server {{name}}:{{../port}} {{address}}:{{../port}} check
|
server {{name}}:{{../port}} {{address}}:{{../port}} check
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
15
test.json
15
test.json
|
@ -4,21 +4,30 @@
|
||||||
"Spec": {"Name": "foo"},
|
"Spec": {"Name": "foo"},
|
||||||
"Endpoint": {
|
"Endpoint": {
|
||||||
"Ports": [
|
"Ports": [
|
||||||
{"PublishedPort": 10001}
|
{
|
||||||
|
"PublishedPort": 10001,
|
||||||
|
"Protocol": "tcp"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"Spec": {"Name": "bar_main"},
|
"Spec": {"Name": "bar_main"},
|
||||||
"Endpoint": {
|
"Endpoint": {
|
||||||
"Ports": [
|
"Ports": [
|
||||||
{"PublishedPort": 10003}
|
{
|
||||||
|
"PublishedPort": 10003,
|
||||||
|
"Protocol": "tcp"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"Spec": {"Name": "bar_foo"},
|
"Spec": {"Name": "bar_foo"},
|
||||||
"Endpoint": {
|
"Endpoint": {
|
||||||
"Ports": [
|
"Ports": [
|
||||||
{"PublishedPort": 10003}
|
{
|
||||||
|
"PublishedPort": 10003,
|
||||||
|
"Protocol": "udp"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|
Reference in New Issue