Merge pull request 'feat: use the connection if it is passed as a parameter' (!7) from useCustomNetwork into master

Reviewed-on: #7
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
This commit is contained in:
Alex Moreno 2024-10-03 12:25:36 +00:00
commit 2b6a97c243
1 changed files with 3 additions and 2 deletions

View File

@ -125,13 +125,14 @@ class Run extends Command {
try { try {
const server = new Server(ct, dbConfig); const server = new Server(ct, dbConfig);
if (isRandom) { const useCustom = opts.ci || opts.network
if (isRandom || useCustom) {
try { try {
const netSettings = await ct.inspect({ const netSettings = await ct.inspect({
format: '{{json .NetworkSettings}}' format: '{{json .NetworkSettings}}'
}); });
if (opts.ci || opts.network) { if (useCustom) {
dbConfig.host = opts.network dbConfig.host = opts.network
? netSettings.Networks[opts.network].IPAddress ? netSettings.Networks[opts.network].IPAddress
: netSettings.Gateway; : netSettings.Gateway;