Fix missing default value in configuration
parent
c82f910da3
commit
73be5bfc68
|
@ -24,14 +24,14 @@ export class ConfigurationParser {
|
||||||
const validationErrors = this.parseTypes(configuration);
|
const validationErrors = this.parseTypes(configuration);
|
||||||
if (validationErrors.length > 0) {
|
if (validationErrors.length > 0) {
|
||||||
validationErrors.forEach((e: string) => { console.log(e); });
|
validationErrors.forEach((e: string) => { console.log(e); });
|
||||||
throw new Error("Malformed configuration. Please double-check your configuration file.");
|
throw new Error("Malformed configuration (schema). Please double-check your configuration file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const [newConfiguration, completionErrors] = complete(configuration);
|
const [newConfiguration, completionErrors] = complete(configuration);
|
||||||
|
|
||||||
if (completionErrors.length > 0) {
|
if (completionErrors.length > 0) {
|
||||||
completionErrors.forEach((e: string) => { console.log(e); });
|
completionErrors.forEach((e: string) => { console.log(e); });
|
||||||
throw new Error("Malformed configuration. Please double-check your configuration file.");
|
throw new Error("Malformed configuration (validator). Please double-check your configuration file.");
|
||||||
}
|
}
|
||||||
return newConfiguration;
|
return newConfiguration;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,9 @@ export interface NotifierConfiguration {
|
||||||
export function complete(configuration: NotifierConfiguration): [NotifierConfiguration, string] {
|
export function complete(configuration: NotifierConfiguration): [NotifierConfiguration, string] {
|
||||||
const newConfiguration: NotifierConfiguration = (configuration) ? JSON.parse(JSON.stringify(configuration)) : {};
|
const newConfiguration: NotifierConfiguration = (configuration) ? JSON.parse(JSON.stringify(configuration)) : {};
|
||||||
|
|
||||||
|
if (Object.keys(newConfiguration).length == 0)
|
||||||
|
newConfiguration.filesystem = { filename: '/tmp/authelia-notification.txt' };
|
||||||
|
|
||||||
const ERROR = "Notifier must have one of the following keys: 'filesystem', 'email' or 'smtp'";
|
const ERROR = "Notifier must have one of the following keys: 'filesystem', 'email' or 'smtp'";
|
||||||
|
|
||||||
if (Object.keys(newConfiguration).length != 1)
|
if (Object.keys(newConfiguration).length != 1)
|
||||||
|
|
Loading…
Reference in New Issue