feat: refs #5483 network param added to run cmd
This commit is contained in:
parent
89cfa65084
commit
2daf409f82
|
@ -279,7 +279,7 @@ Builds and starts local database server container. It only rebuilds the image
|
|||
when dump have been modified.
|
||||
|
||||
```text
|
||||
$ myt run [-c|--ci] [-r|--random]
|
||||
$ myt run [-c|--ci] [-r|--random] [-n|--network <string>]
|
||||
```
|
||||
|
||||
### start
|
||||
|
|
16
myt-run.js
16
myt-run.js
|
@ -18,13 +18,15 @@ class Run extends Command {
|
|||
description: 'Build and start local database server container',
|
||||
params: {
|
||||
ci: 'Workaround for continuous integration system',
|
||||
random: 'Whether to use a random container name or port'
|
||||
network: 'Docker network to attach container to',
|
||||
random: 'Whether to use a random container name and port'
|
||||
}
|
||||
};
|
||||
|
||||
static opts = {
|
||||
alias: {
|
||||
ci: 'c',
|
||||
network: 'n',
|
||||
random: 'r'
|
||||
},
|
||||
boolean: [
|
||||
|
@ -104,6 +106,9 @@ class Run extends Command {
|
|||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (opts.network)
|
||||
Object.assign(runOptions, {network: opts.network});
|
||||
|
||||
const runChown = process.platform != 'linux';
|
||||
|
||||
Object.assign(runOptions, null, {
|
||||
|
@ -120,10 +125,11 @@ class Run extends Command {
|
|||
format: '{{json .NetworkSettings}}'
|
||||
});
|
||||
|
||||
if (opts.ci)
|
||||
dbConfig.host = netSettings.Gateway;
|
||||
|
||||
dbConfig.port = netSettings.Ports['3306/tcp'][0].HostPort;
|
||||
if (opts.ci) {
|
||||
dbConfig.host = netSettings.Networks[networkName].IPAddress;
|
||||
dbConfig.port = 3306;
|
||||
} else
|
||||
dbConfig.port = netSettings.Ports['3306/tcp'][0].HostPort;
|
||||
} catch (err) {
|
||||
await server.rm();
|
||||
throw err;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@verdnatura/myt",
|
||||
"version": "1.5.31",
|
||||
"version": "1.5.32",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@verdnatura/myt",
|
||||
"version": "1.5.31",
|
||||
"version": "1.5.32",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@sqltools/formatter": "^1.2.5",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@verdnatura/myt",
|
||||
"version": "1.5.31",
|
||||
"version": "1.5.32",
|
||||
"author": "Verdnatura Levante SL",
|
||||
"description": "MySQL version control",
|
||||
"license": "GPL-3.0",
|
||||
|
|
Loading…
Reference in New Issue