fix: docker compose env file

This commit is contained in:
Andras Bacsai
2023-08-12 00:10:14 +02:00
parent 1c8c567791
commit 3b25c8f96b
4 changed files with 18 additions and 17 deletions

View File

@@ -381,7 +381,6 @@ main()
reEncryptSecrets()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();

View File

@@ -19,7 +19,9 @@ export default async function (data) {
dockerComposeConfiguration,
dockerComposeFileLocation
} = data;
const fileYaml = `${workdir}${baseDirectory}${dockerComposeFileLocation}`;
const baseDir = `${workdir}${baseDirectory}`;
const envFile = `${baseDir}/.env`;
const fileYaml = `${baseDir}${dockerComposeFileLocation}`;
const dockerComposeRaw = await fs.readFile(fileYaml, 'utf8');
const dockerComposeYaml = yaml.load(dockerComposeRaw);
if (!dockerComposeYaml.services) {
@@ -31,7 +33,7 @@ export default async function (data) {
envs = [...envs, ...generateSecrets(secrets, pullmergeRequestId, false, null)];
buildEnvs = [...buildEnvs, ...generateSecrets(secrets, pullmergeRequestId, true, null, true)];
}
await fs.writeFile(envFile, envs.join('\n'));
const composeVolumes = [];
if (volumes.length > 0) {
for (const volume of volumes) {
@@ -50,19 +52,19 @@ export default async function (data) {
if (value['env_file']) {
delete value['env_file'];
}
value['env_file'] = [envFile];
let environment = typeof value['environment'] === 'undefined' ? [] : value['environment'];
let finalEnvs = [...envs];
if (Object.keys(environment).length > 0) {
for (const arg of Object.keys(environment)) {
const [key, _] = arg.split('=');
if (finalEnvs.filter((env) => env.startsWith(key)).length === 0) {
finalEnvs.push(arg);
}
}
// environment = Object.entries(environment).map(([key, value]) => `${key}=${value}`);
}
value['environment'] = [...finalEnvs];
// let environment = typeof value['environment'] === 'undefined' ? [] : value['environment'];
// let finalEnvs = [...envs];
// if (Object.keys(environment).length > 0) {
// for (const arg of Object.keys(environment)) {
// const [key, _] = arg.split('=');
// if (finalEnvs.filter((env) => env.startsWith(key)).length === 0) {
// finalEnvs.push(arg);
// }
// }
// }
// value['environment'] = [...finalEnvs];
let build = typeof value['build'] === 'undefined' ? [] : value['build'];
if (typeof build === 'string') {

View File

@@ -18,7 +18,7 @@ import { scheduler } from './scheduler';
import type { ExecaChildProcess } from 'execa';
import { FastifyReply } from 'fastify';
export const version = '3.12.36';
export const version = '3.12.37';
export const isDev = process.env.NODE_ENV === 'development';
export const proxyPort = process.env.COOLIFY_PROXY_PORT;
export const proxySecurePort = process.env.COOLIFY_PROXY_SECURE_PORT;

View File

@@ -1,7 +1,7 @@
{
"name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "3.12.36",
"version": "3.12.37",
"license": "Apache-2.0",
"repository": "github:coollabsio/coolify",
"scripts": {