AppConfig: Move default for rendererOrigin to config file

As we only use rendererOrigin in the frontend config service, where domain will be used if it is not defined, it makes more sense to move this default behavior to the app config directly. That makes it easier to understand what this variable contains and that it defaults to domain.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-04-25 15:20:51 +02:00 committed by David Mehren
parent 116aa5e022
commit 662d428e3c
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
2 changed files with 5 additions and 4 deletions

View file

@ -20,7 +20,10 @@ export interface AppConfig {
const schema = Joi.object({
domain: Joi.string().label('HD_DOMAIN'),
rendererOrigin: Joi.string().optional().label('HD_RENDERER_ORIGIN'),
rendererOrigin: Joi.string()
.default(Joi.ref('domain'))
.optional()
.label('HD_RENDERER_ORIGIN'),
port: Joi.number().default(3000).optional().label('PORT'),
loglevel: Joi.string()
.valid(...Object.values(Loglevel))

View file

@ -129,9 +129,7 @@ export class FrontendConfigService {
private getIframeCommunication(): IframeCommunicationDto {
return {
editorOrigin: new URL(this.appConfig.domain),
rendererOrigin: this.appConfig.rendererOrigin
? new URL(this.appConfig.rendererOrigin)
: new URL(this.appConfig.domain),
rendererOrigin: new URL(this.appConfig.rendererOrigin),
};
}
}