2019-01-30 15:47:03 +00:00
|
|
|
#!/usr/bin/env node
|
2019-01-27 14:54:29 +00:00
|
|
|
|
2019-01-30 15:47:03 +00:00
|
|
|
var program = require('commander');
|
|
|
|
var spawn = require('child_process').spawn;
|
2019-01-27 14:54:29 +00:00
|
|
|
|
2019-03-02 15:19:08 +00:00
|
|
|
let config;
|
2019-01-27 14:54:29 +00:00
|
|
|
|
2019-03-02 15:19:08 +00:00
|
|
|
program
|
|
|
|
.description('Run Authelia server with a custom configuration file. This is an alternative to suites in the case the environment is already set up.')
|
|
|
|
.arguments('[config_file]', 'Configuration file to run Authelia with.')
|
|
|
|
.action((configArg) => config = configArg)
|
|
|
|
.parse(process.argv);
|
2019-01-30 15:47:03 +00:00
|
|
|
|
|
|
|
|
2019-03-02 15:19:08 +00:00
|
|
|
if (!config) {
|
|
|
|
config = 'config.yml'; // set default config file.;
|
2019-01-30 15:47:03 +00:00
|
|
|
}
|
|
|
|
|
2019-03-02 15:19:08 +00:00
|
|
|
const server = spawn('/usr/bin/env', ['node', 'dist/server/src/index.js', config]);
|
2019-02-24 15:42:29 +00:00
|
|
|
|
2019-03-02 15:19:08 +00:00
|
|
|
server.stdout.pipe(process.stdout);
|
|
|
|
server.stderr.pipe(process.stderr);
|
2019-02-24 15:42:29 +00:00
|
|
|
|
|
|
|
server.on('exit', function(statusCode) {
|
|
|
|
process.exit(statusCode);
|
2019-03-02 15:19:08 +00:00
|
|
|
});
|