mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
76fa325f08
Authelia client uses hash router instead of browser router in order to work with Kubernetes nginx-ingress-controller. This is also better for users having old browsers. This commit is breaking because it requires to change the configuration of the proxy to include the # in the URL of the login portal.
42 lines
947 B
TypeScript
42 lines
947 B
TypeScript
var spawn = require('child_process').spawn;
|
|
|
|
interface Options {
|
|
cwd?: string;
|
|
env?: {[key: string]: string};
|
|
debug?: boolean;
|
|
}
|
|
|
|
export function exec(command: string, options?: Options): Promise<void> {
|
|
return new Promise((resolve, reject) => {
|
|
const spawnOptions = {
|
|
shell: true,
|
|
} as any;
|
|
|
|
if (options && options.cwd) {
|
|
spawnOptions['cwd'] = options.cwd;
|
|
}
|
|
|
|
if (options && options.env) {
|
|
spawnOptions['env'] = {
|
|
...options.env,
|
|
...process.env,
|
|
}
|
|
}
|
|
|
|
if (options && options.debug) {
|
|
console.log('>>> ' + command);
|
|
}
|
|
const cmd = spawn(command, spawnOptions);
|
|
|
|
cmd.stdout.pipe(process.stdout);
|
|
cmd.stderr.pipe(process.stderr);
|
|
cmd.on('exit', (statusCode: number) => {
|
|
if (statusCode == 0) {
|
|
resolve();
|
|
return;
|
|
}
|
|
reject(new Error('\'' + command + '\' exited with status code ' + statusCode));
|
|
});
|
|
});
|
|
}
|