2017-05-13 23:12:26 +07:00
|
|
|
#! /usr/bin/env node
|
|
|
|
|
|
|
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
|
|
|
2017-05-17 04:17:46 +07:00
|
|
|
import Server from "./lib/Server";
|
2017-06-30 00:41:05 +07:00
|
|
|
import { GlobalDependencies } from "../types/Dependencies";
|
2017-05-13 23:12:26 +07:00
|
|
|
const YAML = require("yamljs");
|
|
|
|
|
2017-06-30 00:41:05 +07:00
|
|
|
const configurationFilepath = process.argv[2];
|
|
|
|
if (!configurationFilepath) {
|
2017-05-13 23:12:26 +07:00
|
|
|
console.log("No config file has been provided.");
|
|
|
|
console.log("Usage: authelia <config>");
|
|
|
|
process.exit(0);
|
|
|
|
}
|
|
|
|
|
2017-06-30 00:41:05 +07:00
|
|
|
console.log("Parse configuration file: %s", configurationFilepath);
|
2017-05-13 23:12:26 +07:00
|
|
|
|
2017-07-14 05:25:11 +07:00
|
|
|
const yamlContent = YAML.load(configurationFilepath);
|
2017-05-13 23:12:26 +07:00
|
|
|
|
2017-06-30 00:41:05 +07:00
|
|
|
const deps: GlobalDependencies = {
|
2017-05-25 20:09:29 +07:00
|
|
|
u2f: require("u2f"),
|
2017-05-13 23:12:26 +07:00
|
|
|
nodemailer: require("nodemailer"),
|
|
|
|
ldapjs: require("ldapjs"),
|
|
|
|
session: require("express-session"),
|
|
|
|
winston: require("winston"),
|
|
|
|
speakeasy: require("speakeasy"),
|
2017-06-30 00:41:05 +07:00
|
|
|
nedb: require("nedb"),
|
|
|
|
ConnectRedis: require("connect-redis")
|
2017-05-13 23:12:26 +07:00
|
|
|
};
|
|
|
|
|
2017-05-17 04:17:46 +07:00
|
|
|
const server = new Server();
|
2017-07-14 05:25:11 +07:00
|
|
|
server.start(yamlContent, deps)
|
2017-05-17 04:17:46 +07:00
|
|
|
.then(() => {
|
|
|
|
console.log("The server is started!");
|
|
|
|
});
|