fix: dashboard error

This commit is contained in:
Andras Bacsai
2022-11-11 13:28:37 +01:00
parent 39ba498293
commit cea894a8bd
5 changed files with 60 additions and 21 deletions

View File

@@ -17,7 +17,7 @@ import { day } from './dayjs';
import { saveBuildLog } from './buildPacks/common';
import { scheduler } from './scheduler';
export const version = '3.11.6';
export const version = '3.11.7';
export const isDev = process.env.NODE_ENV === 'development';
const algorithm = 'aes-256-ctr';

View File

@@ -2,11 +2,16 @@ import { isDev } from "./common";
import fs from 'fs/promises';
export async function getTemplates() {
const templatePath = isDev ? './templates.json' : '/app/templates.json';
const ts = await fs.readFile(templatePath, 'utf8')
if (ts) {
return JSON.parse(ts);
const open = await fs.open(templatePath, 'r');
let data;
try {
data = await open.readFile({ encoding: 'utf-8' });
return JSON.parse(data);
} catch (error) {
return []
} finally {
await open?.close()
}
return [];
}
const compareSemanticVersions = (a: string, b: string) => {
const a1 = a.split('.');

View File

@@ -34,7 +34,6 @@ export async function startService(request: FastifyRequest<ServiceStartStop>, fa
const { id } = request.params;
const teamId = request.user.teamId;
const service = await getServiceFromDB({ id, teamId });
console.log({service})
const arm = isARM(service.arch);
const { type, destinationDockerId, destinationDocker, persistentStorage, exposePort } =
service;