nunjucks: override default dump filter to allow circular dependencies

This commit is contained in:
Alice Gaudon 2020-07-26 11:37:36 +02:00
parent 21b7def9e4
commit b179afdaf5

View File

@ -6,6 +6,7 @@ import Controller from "../Controller";
import {ServerError} from "../HttpError";
import * as querystring from "querystring";
import {ParsedUrlQueryInput} from "querystring";
import * as util from "util";
export default class NunjucksComponent extends ApplicationComponent<void> {
public static getPreviousURL(req: Request, defaultUrl?: string): string {
@ -52,6 +53,9 @@ export default class NunjucksComponent extends ApplicationComponent<void> {
.addGlobal('app_version', this.app!.getVersion())
.addGlobal('core_version', coreVersion)
.addGlobal('querystring', querystring)
.addFilter('dump', (val) => {
return util.inspect(val);
})
.addFilter('hex', (v: number) => {
return v.toString(16);
});