This commit is contained in:
Louis Lam 2023-12-04 15:59:01 +08:00
parent 8053e9940e
commit 3537b842ec
4 changed files with 20 additions and 0 deletions

View file

@ -32,6 +32,8 @@ import User from "./models/user";
import childProcessAsync from "promisify-child-process";
import { Terminal } from "./terminal";
import "dotenv/config";
export class DockgeServer {
app : Express;
httpServer : http.Server;

View file

@ -99,6 +99,15 @@ export class Stack {
// Check YAML format
yaml.parse(this.composeYAML);
let lines = this.composeENV.split("\n");
// Check if the .env is able to pass docker-compose
// Prevent "setenv: The parameter is incorrect"
// It only happens when there is one line and it doesn't contain "="
if (lines.length === 1 && !lines[0].includes("=")) {
throw new ValidationError("Invalid .env format");
}
}
get composeYAML() : string {

View file

@ -33,6 +33,7 @@
"composerize": "~1.4.1",
"croner": "~7.0.5",
"dayjs": "~1.11.10",
"dotenv": "~16.3.1",
"express": "~4.18.2",
"express-static-gzip": "~2.1.7",
"http-graceful-shutdown": "~3.1.13",

View file

@ -32,6 +32,9 @@ dependencies:
dayjs:
specifier: ~1.11.10
version: 1.11.10
dotenv:
specifier: ~16.3.1
version: 16.3.1
express:
specifier: ~4.18.2
version: 4.18.2
@ -2154,6 +2157,11 @@ packages:
esutils: 2.0.3
dev: true
/dotenv@16.3.1:
resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==}
engines: {node: '>=12'}
dev: false
/eastasianwidth@0.2.0:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
dev: false