refactor: update findAppRoot function and adjust Dockerfile paths for consistency

This commit is contained in:
2026-04-20 07:21:56 +02:00
parent 9100f71ab5
commit 4f97dc3362
3 changed files with 11 additions and 11 deletions

View File

@@ -3,7 +3,7 @@ import { join } from "node:path";
import nunjucks from "nunjucks";
import type { ImageSelection, UsageTemplate } from "./types";
const findAppNewRoot = (): string => {
const findAppRoot = (): string => {
const candidates = [join(__dirname, "../../.."), join(__dirname, "../..")];
for (const candidate of candidates) {
@@ -12,19 +12,19 @@ const findAppNewRoot = (): string => {
}
}
throw new Error("Unable to resolve app-new template root");
throw new Error("Unable to resolve app template root");
};
export class TemplateService {
private readonly appNewRoot = findAppNewRoot();
private readonly appRoot = findAppRoot();
private readonly env = nunjucks.configure(join(this.appNewRoot, "templates"), {
private readonly env = nunjucks.configure(join(this.appRoot, "templates"), {
autoescape: false,
noCache: true
});
private readonly templates: UsageTemplate[] = JSON.parse(
readFileSync(join(this.appNewRoot, "templates.json"), "utf8")
readFileSync(join(this.appRoot, "templates.json"), "utf8")
) as UsageTemplate[];
public getTemplates(): UsageTemplate[] {