mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-30 22:20:48 +00:00
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:
parent
116aa5e022
commit
662d428e3c
2 changed files with 5 additions and 4 deletions
|
@ -20,7 +20,10 @@ export interface AppConfig {
|
||||||
|
|
||||||
const schema = Joi.object({
|
const schema = Joi.object({
|
||||||
domain: Joi.string().label('HD_DOMAIN'),
|
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'),
|
port: Joi.number().default(3000).optional().label('PORT'),
|
||||||
loglevel: Joi.string()
|
loglevel: Joi.string()
|
||||||
.valid(...Object.values(Loglevel))
|
.valid(...Object.values(Loglevel))
|
||||||
|
|
|
@ -129,9 +129,7 @@ export class FrontendConfigService {
|
||||||
private getIframeCommunication(): IframeCommunicationDto {
|
private getIframeCommunication(): IframeCommunicationDto {
|
||||||
return {
|
return {
|
||||||
editorOrigin: new URL(this.appConfig.domain),
|
editorOrigin: new URL(this.appConfig.domain),
|
||||||
rendererOrigin: this.appConfig.rendererOrigin
|
rendererOrigin: new URL(this.appConfig.rendererOrigin),
|
||||||
? new URL(this.appConfig.rendererOrigin)
|
|
||||||
: new URL(this.appConfig.domain),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue