2016-09-28 23:54:19 +02:00
|
|
|
#!/usr/bin/env node
|
|
|
|
'use strict';
|
|
|
|
|
2016-09-29 18:10:23 +02:00
|
|
|
process.env.NODE_ENV = 'production';
|
|
|
|
|
2016-12-02 16:34:05 +01:00
|
|
|
const serverImpl = require('../lib/server-impl.js');
|
2016-09-28 23:54:19 +02:00
|
|
|
|
2016-12-03 13:45:22 +01:00
|
|
|
const argv = require('yargs')
|
|
|
|
.usage('$0 [options]')
|
|
|
|
.env(true)
|
|
|
|
.option('port', {
|
|
|
|
alias: 'p',
|
|
|
|
describe: 'The HTTP port you want to start unleash on',
|
|
|
|
demand: false,
|
|
|
|
default: 4242,
|
|
|
|
type: 'number',
|
|
|
|
})
|
2018-05-06 10:23:53 +02:00
|
|
|
.option('host', {
|
|
|
|
alias: 'l',
|
|
|
|
describe: 'The HTTP address the server will accept connections on.',
|
|
|
|
demand: false,
|
|
|
|
type: 'string',
|
|
|
|
})
|
2016-12-03 13:45:22 +01:00
|
|
|
.option('databaseUrl', {
|
|
|
|
alias: 'd',
|
2017-06-28 14:10:32 +02:00
|
|
|
describe:
|
|
|
|
'The full databaseUrl to connect to, including username and password',
|
2016-12-03 13:45:22 +01:00
|
|
|
demand: true,
|
|
|
|
type: 'string',
|
2019-02-01 08:06:02 +01:00
|
|
|
})
|
|
|
|
.option('databaseSchema', {
|
|
|
|
alias: 's',
|
|
|
|
describe: 'The database schema to use',
|
|
|
|
default: 'public',
|
|
|
|
demand: false,
|
|
|
|
type: 'string',
|
2017-06-28 14:10:32 +02:00
|
|
|
}).argv;
|
2016-12-03 13:45:22 +01:00
|
|
|
|
2017-06-28 14:10:32 +02:00
|
|
|
serverImpl
|
|
|
|
.start(argv)
|
2018-05-06 12:17:46 +02:00
|
|
|
.then(instance => {
|
2018-05-06 12:50:43 +02:00
|
|
|
const address = instance.server.address();
|
2017-06-28 14:10:32 +02:00
|
|
|
console.log(
|
2018-05-06 12:50:43 +02:00
|
|
|
`Unleash started on http://${address.address}:${address.port}`
|
2018-05-06 12:17:46 +02:00
|
|
|
);
|
|
|
|
})
|
2017-06-28 14:10:32 +02:00
|
|
|
.catch(console.err);
|