2019-01-30 22:47:03 +07:00
|
|
|
#!/usr/bin/env node
|
2019-01-27 21:54:29 +07:00
|
|
|
|
2019-01-30 22:47:03 +07:00
|
|
|
var program = require('commander');
|
|
|
|
var spawn = require('child_process').spawn;
|
2019-01-27 21:54:29 +07:00
|
|
|
|
2019-03-02 22:19:08 +07:00
|
|
|
let config;
|
2019-01-27 21:54:29 +07:00
|
|
|
|
2019-03-02 22:19:08 +07: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 22:47:03 +07:00
|
|
|
|
|
|
|
|
2019-03-02 22:19:08 +07:00
|
|
|
if (!config) {
|
|
|
|
config = 'config.yml'; // set default config file.;
|
2019-01-30 22:47:03 +07:00
|
|
|
}
|
|
|
|
|
2019-03-02 22:19:08 +07:00
|
|
|
const server = spawn('/usr/bin/env', ['node', 'dist/server/src/index.js', config]);
|
2019-02-24 22:42:29 +07:00
|
|
|
|
2019-03-02 22:19:08 +07:00
|
|
|
server.stdout.pipe(process.stdout);
|
|
|
|
server.stderr.pipe(process.stderr);
|
2019-02-24 22:42:29 +07:00
|
|
|
|
|
|
|
server.on('exit', function(statusCode) {
|
|
|
|
process.exit(statusCode);
|
2019-03-02 22:19:08 +07:00
|
|
|
});
|