Config: Add WebDAV to media config

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-04-16 13:19:13 +02:00 committed by David Mehren
parent 157d9bb21c
commit edf71cc177
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
2 changed files with 27 additions and 0 deletions

View file

@ -28,6 +28,11 @@ export interface MediaConfig {
imgur: {
clientID: string;
};
webdav: {
connectionString: string;
uploadDir: string;
publicUrl: string;
};
};
}
@ -70,6 +75,21 @@ const mediaSchema = Joi.object({
}),
otherwise: Joi.optional(),
}),
webdav: Joi.when('use', {
is: Joi.valid(BackendType.WEBDAV),
then: Joi.object({
connectionString: Joi.string()
.uri()
.label('HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING'),
uploadDir: Joi.string()
.optional()
.label('HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR'),
publicUrl: Joi.string()
.uri()
.label('HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL'),
}),
otherwise: Joi.optional(),
}),
},
});
@ -95,6 +115,12 @@ export default registerAs('mediaConfig', () => {
imgur: {
clientID: process.env.HD_MEDIA_BACKEND_IMGUR_CLIENT_ID,
},
webdav: {
connectionString:
process.env.HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING,
uploadDir: process.env.HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR,
publicUrl: process.env.HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL,
},
},
},
{

View file

@ -9,4 +9,5 @@ export enum BackendType {
S3 = 's3',
IMGUR = 'imgur',
AZURE = 'azure',
WEBDAV = 'webdav',
}