MediaConfig: Fix Joi schema alternatives

'...use' tries to go up one level and grab the value of 'use' there and not the same level 'use' as we want here

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-02-23 15:45:59 +01:00 committed by David Mehren
parent 1942df0da0
commit 5195955eb8
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -44,7 +44,7 @@ const mediaSchema = Joi.object({
otherwise: Joi.optional(), otherwise: Joi.optional(),
}).label('HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH'), }).label('HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH'),
}, },
s3: Joi.when('...use', { s3: Joi.when('use', {
is: Joi.valid(BackendType.S3), is: Joi.valid(BackendType.S3),
then: Joi.object({ then: Joi.object({
accessKey: Joi.string().label('HD_MEDIA_BACKEND_S3_ACCESS_KEY'), accessKey: Joi.string().label('HD_MEDIA_BACKEND_S3_ACCESS_KEY'),
@ -55,7 +55,7 @@ const mediaSchema = Joi.object({
}), }),
otherwise: Joi.optional(), otherwise: Joi.optional(),
}), }),
azure: Joi.when('...use', { azure: Joi.when('use', {
is: Joi.valid(BackendType.AZURE), is: Joi.valid(BackendType.AZURE),
then: Joi.object({ then: Joi.object({
connectionString: Joi.string().label( connectionString: Joi.string().label(
@ -65,7 +65,7 @@ const mediaSchema = Joi.object({
}), }),
otherwise: Joi.optional(), otherwise: Joi.optional(),
}), }),
imgur: Joi.when('...use', { imgur: Joi.when('use', {
is: Joi.valid(BackendType.IMGUR), is: Joi.valid(BackendType.IMGUR),
then: Joi.object({ then: Joi.object({
clientID: Joi.string().label('HD_MEDIA_BACKEND_IMGUR_CLIENT_ID'), clientID: Joi.string().label('HD_MEDIA_BACKEND_IMGUR_CLIENT_ID'),