mirror of
https://github.com/danbulant/docker-compose
synced 2026-06-24 17:31:53 +00:00
Exposed the 'env' option on child_process.exec
This commit is contained in:
parent
4127133107
commit
23c976c525
1 changed files with 10 additions and 1 deletions
11
index.js
11
index.js
|
|
@ -37,12 +37,14 @@ const configToArgs = config => {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const execCompose = (command, options) => new Promise((resolve, reject) => {
|
const execCompose = (command, options) => new Promise((resolve, reject) => {
|
||||||
const cmd = `docker-compose ${configToArgs(options.config)} ${command}`;
|
const cmd = `docker-compose ${configToArgs(options.config)} ${command}`;
|
||||||
const cwd = options.cwd;
|
const cwd = options.cwd;
|
||||||
|
const env = options.env || null;
|
||||||
|
|
||||||
execute(cmd, { cwd }).then(
|
execute(cmd, { cwd, env }).then(
|
||||||
standards => {
|
standards => {
|
||||||
const std = {
|
const std = {
|
||||||
out: standards[0],
|
out: standards[0],
|
||||||
|
|
@ -68,6 +70,7 @@ const execCompose = (command, options) => new Promise((resolve, reject) => {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const up = function (options) {
|
const up = function (options) {
|
||||||
return execCompose('up -d', options);
|
return execCompose('up -d', options);
|
||||||
|
|
@ -78,6 +81,7 @@ const up = function (options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const down = function (options) {
|
const down = function (options) {
|
||||||
return execCompose('down', options);
|
return execCompose('down', options);
|
||||||
|
|
@ -88,6 +92,7 @@ const down = function (options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const stop = function (options) {
|
const stop = function (options) {
|
||||||
return execCompose('stop', options);
|
return execCompose('stop', options);
|
||||||
|
|
@ -98,6 +103,7 @@ const stop = function (options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const kill = function (options) {
|
const kill = function (options) {
|
||||||
return execCompose('kill', options);
|
return execCompose('kill', options);
|
||||||
|
|
@ -108,6 +114,7 @@ const kill = function (options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const rm = function (options) {
|
const rm = function (options) {
|
||||||
return execCompose('rm -f', options);
|
return execCompose('rm -f', options);
|
||||||
|
|
@ -121,6 +128,7 @@ const rm = function (options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*
|
*
|
||||||
* @return {object} std.out / std.err
|
* @return {object} std.out / std.err
|
||||||
*/
|
*/
|
||||||
|
|
@ -136,6 +144,7 @@ const exec = function (container, command, options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*
|
*
|
||||||
* @return {object} std.out / std.err
|
* @return {object} std.out / std.err
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue