mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
cleanup bin
This commit is contained in:
parent
f1a24be0e2
commit
35ad3aa072
@ -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);
|
||||
|
||||
|
@ -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 = {
|
||||
|
Loading…
Reference in New Issue
Block a user