authelia/test/helpers/context/AutheliaServer.ts
Clement Michaud d9e487c99f Display only one 2FA option.
Displaying only one option at 2FA stage will allow to add more options
like DUO push or OAuth.

The user can switch to other option and in this case the option is
remembered so that next time, the user will see the same option. The
latest option is considered as the prefered option by Authelia.
2019-03-23 19:34:00 +01:00

26 lines
748 B
TypeScript

import fs from 'fs';
import AutheliaServerWithHotReload from "./AutheliaServerWithHotReload";
import AutheliaServerInterface from './AutheliaServerInterface';
import AutheliaServerFromDist from './AutheliaServerFromDist';
class AutheliaServer implements AutheliaServerInterface {
private runnerImpl: AutheliaServerInterface;
constructor(configPath: string, watchPaths: string[] = []) {
if (fs.existsSync('.suite')) {
this.runnerImpl = new AutheliaServerWithHotReload(configPath, watchPaths);
} else {
this.runnerImpl = new AutheliaServerFromDist(configPath, true);
}
}
async start() {
await this.runnerImpl.start();
}
async stop() {
await this.runnerImpl.stop();
}
}
export default AutheliaServer;