1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/bin/unleash.js

28 lines
694 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
'use strict';
process.env.NODE_ENV = 'production';
const program = require('commander');
2016-12-02 16:34:05 +01:00
const serverImpl = require('../lib/server-impl.js');
program
2016-09-29 22:50:55 +02:00
.option('-p, --port <port>', 'The port you want to start unleash on')
.option('-d, --databaseUri <databaseUri>', 'The full databaseUri to connect to, including username and password')
.parse(process.argv);
2016-12-02 16:34:05 +01:00
const userOpts = {};
2016-12-02 17:21:54 +01:00
2016-12-02 16:34:05 +01:00
if(program.databaseUri) {
userOpts.databaseUri = program.databaseUri;
}
2016-12-02 17:21:54 +01:00
2016-12-02 16:34:05 +01:00
if(program.port) {
userOpts.port = program.port;
}
2016-12-02 17:21:54 +01:00
serverImpl.start(userOpts)
2016-12-02 16:34:05 +01:00
.then(conf => console.log(`Unleash started on http://localhost:${conf.app.get('port')}`))
.catch(console.err);