mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-27 12:08:02 -05:00
Merge pull request #1203 from hedgedoc/config/renderOriginDefault
This commit is contained in:
commit
c05e5bde43
3 changed files with 8 additions and 6 deletions
|
@ -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))
|
||||
|
|
|
@ -21,6 +21,7 @@ import { Loglevel } from '../config/loglevel.enum';
|
|||
*/
|
||||
|
||||
describe('FrontendConfigService', () => {
|
||||
const domain = 'http://md.example.com';
|
||||
const emptyAuthConfig: AuthConfig = {
|
||||
email: {
|
||||
enableLogin: false,
|
||||
|
@ -183,8 +184,8 @@ describe('FrontendConfigService', () => {
|
|||
]) {
|
||||
it(`combination #${index} works`, async () => {
|
||||
const appConfig: AppConfig = {
|
||||
domain: 'http://md.example.com',
|
||||
rendererOrigin: renderOrigin,
|
||||
domain: domain,
|
||||
rendererOrigin: renderOrigin ?? domain,
|
||||
port: 3000,
|
||||
loglevel: Loglevel.ERROR,
|
||||
forbiddenNoteIds: [],
|
||||
|
|
|
@ -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),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue