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.
|
when dump have been modified.
|
||||||
|
|
||||||
```text
|
```text
|
||||||
$ myt run [-c|--ci] [-r|--random]
|
$ myt run [-c|--ci] [-r|--random] [-n|--network <string>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### start
|
### 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',
|
description: 'Build and start local database server container',
|
||||||
params: {
|
params: {
|
||||||
ci: 'Workaround for continuous integration system',
|
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 = {
|
static opts = {
|
||||||
alias: {
|
alias: {
|
||||||
ci: 'c',
|
ci: 'c',
|
||||||
|
network: 'n',
|
||||||
random: 'r'
|
random: 'r'
|
||||||
},
|
},
|
||||||
boolean: [
|
boolean: [
|
||||||
|
@ -104,6 +106,9 @@ class Run extends Command {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opts.network)
|
||||||
|
Object.assign(runOptions, {network: opts.network});
|
||||||
|
|
||||||
const runChown = process.platform != 'linux';
|
const runChown = process.platform != 'linux';
|
||||||
|
|
||||||
Object.assign(runOptions, null, {
|
Object.assign(runOptions, null, {
|
||||||
|
@ -120,10 +125,11 @@ class Run extends Command {
|
||||||
format: '{{json .NetworkSettings}}'
|
format: '{{json .NetworkSettings}}'
|
||||||
});
|
});
|
||||||
|
|
||||||
if (opts.ci)
|
if (opts.ci) {
|
||||||
dbConfig.host = netSettings.Gateway;
|
dbConfig.host = netSettings.Networks[networkName].IPAddress;
|
||||||
|
dbConfig.port = 3306;
|
||||||
dbConfig.port = netSettings.Ports['3306/tcp'][0].HostPort;
|
} else
|
||||||
|
dbConfig.port = netSettings.Ports['3306/tcp'][0].HostPort;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
await server.rm();
|
await server.rm();
|
||||||
throw err;
|
throw err;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@verdnatura/myt",
|
"name": "@verdnatura/myt",
|
||||||
"version": "1.5.31",
|
"version": "1.5.32",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@verdnatura/myt",
|
"name": "@verdnatura/myt",
|
||||||
"version": "1.5.31",
|
"version": "1.5.32",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sqltools/formatter": "^1.2.5",
|
"@sqltools/formatter": "^1.2.5",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@verdnatura/myt",
|
"name": "@verdnatura/myt",
|
||||||
"version": "1.5.31",
|
"version": "1.5.32",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "MySQL version control",
|
"description": "MySQL version control",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
Loading…
Reference in New Issue