mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-01 00:08:27 +01:00
27 lines
763 B
JavaScript
Executable File
27 lines
763 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
'use strict';
|
|
|
|
process.env.NODE_ENV = 'production';
|
|
|
|
const program = require('commander');
|
|
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);
|
|
|
|
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);
|
|
|