Skip to content

Commit 0fa1d01

Browse files
committed
Environment deployments added
1 parent 6037968 commit 0fa1d01

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

bin/dropstack-deploy

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ const copyPaste = require('copy-paste');
1212
const ProgressBar = require('progress');
1313
const FormData = require('form-data');
1414
const credentials = require('../lib/credentials')();
15-
const configuration = require('../lib/settings')();
15+
const configurationSettings = require('../lib/settings');
16+
let configuration;
1617

1718
program
1819
.arguments('[folder]')
1920
.option('-t, --token [token]', 'Use JSON Web Token credentials')
2021
.option('-a, --alias [name]', 'Set alias of deployment', '')
2122
.option('-u, --url [url]', 'Set server URL of deployment', '')
23+
.option('-e, --environment [name]', 'Set an environment name of deployment', '')
2224
.option('-y, --type [name]', 'Set type of deployment manually')
2325
.option('-s, --https', 'Enable HTTPS/HTTP2/SPDY of deployment')
2426
.option('-v, --variables [items]', 'Key=Value variables', (item, list) => { list.push(item); return list; }, [])
@@ -27,7 +29,9 @@ program
2729

2830
deploy(Object.assign(program.opts(), {folder: program.args.length === 0 ? process.cwd() : program.args[0] }));
2931

30-
function deploy({folder, token, variables, instances, alias, https, type, url}){
32+
function deploy({folder, token, variables, instances, alias, https, type, url, environment}){
33+
configuration = configurationSettings(`.dropstack${environment ? '.' + environment + '.' : '.'}json`);
34+
3135
const args = path.resolve(folder);
3236
const pathObj = path.parse(args);
3337
const tarPath = path.join(os.tmpdir(), `${pathObj.name}.tar`);

lib/settings.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
const path = require('path');
22
const fsp = require('fs-promise');
33

4-
module.exports = (config = {projectFileName: '.dropstack.json', globalFileName: '.settings.json'}) => {
5-
const projectSettingsFile = path.resolve(process.cwd(), config.projectFileName);
6-
const globalSettingsFile = path.resolve(__dirname, config.globalFileName);
4+
module.exports = projectFileName => {
5+
projectFileName = projectFileName || '.dropstack.json';
6+
const globalFileName = '.settings.json';
7+
const projectSettingsFile = path.resolve(process.cwd(), projectFileName);
8+
const globalSettingsFile = path.resolve(__dirname, globalFileName);
79

810
process.on('SIGINT', () => process.exit(0));
911

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dropstack-cli",
3-
"version": "1.5.2",
3+
"version": "1.6.0",
44
"description": "A CLI to simplify continuous deployments via Web-Service API and Docker Swarm with integrated SSL, DNS-Server and JWT authentification.",
55
"bin": {
66
"dropstack": "./bin/dropstack"

0 commit comments

Comments
 (0)