From f37d3580b77fb26c85ae16df3053040bb89e7b3d Mon Sep 17 00:00:00 2001 From: Nina Morgan Date: Wed, 29 Mar 2023 16:58:50 -0400 Subject: [PATCH] add support for Docker TLS based connections --- src/utils/config/docker.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/utils/config/docker.js b/src/utils/config/docker.js index 288e8233e..8f658db21 100644 --- a/src/utils/config/docker.js +++ b/src/utils/config/docker.js @@ -27,10 +27,22 @@ export default function getDockerArguments(server) { } if (servers[server].host) { - return { - conn: { host: servers[server].host, port: servers[server].port || null }, + const res ={ + conn: { host: servers[server].host }, swarm: !!servers[server].swarm, - }; + } + + if (servers[server].port){ + res.conn.port = servers[server].port; + } + + if (servers[server].tls){ + res.conn.ca = readFileSync(path.join(process.cwd(), "config", servers[server].tls.caFile)); + res.conn.cert = readFileSync(path.join(process.cwd(), "config", servers[server].tls.certFile)); + res.conn.key = readFileSync(path.join(process.cwd(), "config", servers[server].tls.keyFile)); + } + + return res; } return servers[server];