1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

cleanup bin

This commit is contained in:
ivaosthu 2016-12-02 16:34:05 +01:00 committed by Ivar Conradi Østhus
parent f1a24be0e2
commit 35ad3aa072
3 changed files with 16 additions and 11 deletions

View File

@ -3,20 +3,24 @@
process.env.NODE_ENV = 'production';
const { publicFolder } = require('unleash-frontend');
const program = require('commander');
const unleash = require('../lib/server-impl.js');
const { createOptions } = require('../lib/options.js');
const serverImpl = require('../lib/server-impl.js');
program
.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);
unleash.start({
databaseUri: program.databaseUri || process.env.DATABASE_URL,
port: program.port || process.env.PORT || 4242,
publicFolder,
}).then(conf => {
console.log(`Unleash started on port:${conf.app.get('port')}`);
});
const userOpts = {};
if(program.databaseUri) {
userOpts.databaseUri = program.databaseUri;
}
if(program.port) {
userOpts.port = program.port;
}
serverImpl.start(createOptions(userOpts))
.then(conf => console.log(`Unleash started on http://localhost:${conf.app.get('port')}`))
.catch(console.err);

View File

@ -1,10 +1,12 @@
'use strict';
const { publicFolder } = require('unleash-frontend');
const DEFAULT_OPTIONS = {
databaseUri: process.env.DATABASE_URL,
port: process.env.HTTP_PORT || process.env.PORT || 4242,
baseUriPath: process.env.BASE_URI_PATH || '',
serverMetrics: true,
publicFolder,
};
module.exports = {

View File

@ -1,6 +1,5 @@
'use strict';
const unleash = require('./lib/server-impl');
const { publicFolder } = require('unleash-frontend');
unleash.start({ publicFolder });
unleash.start();