mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 00:54:43 -04: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({
|
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))
|
||||||
|
|
|
@ -21,6 +21,7 @@ import { Loglevel } from '../config/loglevel.enum';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
describe('FrontendConfigService', () => {
|
describe('FrontendConfigService', () => {
|
||||||
|
const domain = 'http://md.example.com';
|
||||||
const emptyAuthConfig: AuthConfig = {
|
const emptyAuthConfig: AuthConfig = {
|
||||||
email: {
|
email: {
|
||||||
enableLogin: false,
|
enableLogin: false,
|
||||||
|
@ -183,8 +184,8 @@ describe('FrontendConfigService', () => {
|
||||||
]) {
|
]) {
|
||||||
it(`combination #${index} works`, async () => {
|
it(`combination #${index} works`, async () => {
|
||||||
const appConfig: AppConfig = {
|
const appConfig: AppConfig = {
|
||||||
domain: 'http://md.example.com',
|
domain: domain,
|
||||||
rendererOrigin: renderOrigin,
|
rendererOrigin: renderOrigin ?? domain,
|
||||||
port: 3000,
|
port: 3000,
|
||||||
loglevel: Loglevel.ERROR,
|
loglevel: Loglevel.ERROR,
|
||||||
forbiddenNoteIds: [],
|
forbiddenNoteIds: [],
|
||||||
|
|
|
@ -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…
Add table
Add a link
Reference in a new issue