fix: duplicate env variables
This commit is contained in:
@@ -141,9 +141,12 @@ import * as buildpacks from '../lib/buildPacks';
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
let envs = ['NODE_ENV=production', `PORT=${port}`];
|
let envs = [];
|
||||||
if (secrets.length > 0) {
|
if (secrets.length > 0) {
|
||||||
envs = [...envs, ...generateSecrets(secrets, pullmergeRequestId)];
|
envs = [
|
||||||
|
...envs,
|
||||||
|
...generateSecrets(secrets, pullmergeRequestId, false, port)
|
||||||
|
];
|
||||||
}
|
}
|
||||||
await fs.writeFile(`${workdir}/Dockerfile`, simpleDockerfile);
|
await fs.writeFile(`${workdir}/Dockerfile`, simpleDockerfile);
|
||||||
if (dockerRegistry) {
|
if (dockerRegistry) {
|
||||||
@@ -676,9 +679,12 @@ import * as buildpacks from '../lib/buildPacks';
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
let envs = ['NODE_ENV=production', `PORT=${port}`];
|
let envs = [];
|
||||||
if (secrets.length > 0) {
|
if (secrets.length > 0) {
|
||||||
envs = [...envs, ...generateSecrets(secrets, pullmergeRequestId)];
|
envs = [
|
||||||
|
...envs,
|
||||||
|
...generateSecrets(secrets, pullmergeRequestId, false, port)
|
||||||
|
];
|
||||||
}
|
}
|
||||||
if (dockerRegistry) {
|
if (dockerRegistry) {
|
||||||
const { url, username, password } = dockerRegistry;
|
const { url, username, password } = dockerRegistry;
|
||||||
|
@@ -25,9 +25,9 @@ export default async function (data) {
|
|||||||
if (!dockerComposeYaml.services) {
|
if (!dockerComposeYaml.services) {
|
||||||
throw 'No Services found in docker-compose file.';
|
throw 'No Services found in docker-compose file.';
|
||||||
}
|
}
|
||||||
let envs = ['NODE_ENV=production'];
|
let envs = [];
|
||||||
if (secrets.length > 0) {
|
if (secrets.length > 0) {
|
||||||
envs = [...envs, ...generateSecrets(secrets, pullmergeRequestId)];
|
envs = [...envs, ...generateSecrets(secrets, pullmergeRequestId, false, null)];
|
||||||
}
|
}
|
||||||
|
|
||||||
const composeVolumes = [];
|
const composeVolumes = [];
|
||||||
|
@@ -19,7 +19,7 @@ import { saveBuildLog, saveDockerRegistryCredentials } from './buildPacks/common
|
|||||||
import { scheduler } from './scheduler';
|
import { scheduler } from './scheduler';
|
||||||
import type { ExecaChildProcess } from 'execa';
|
import type { ExecaChildProcess } from 'execa';
|
||||||
|
|
||||||
export const version = '3.12.3';
|
export const version = '3.12.4';
|
||||||
export const isDev = process.env.NODE_ENV === 'development';
|
export const isDev = process.env.NODE_ENV === 'development';
|
||||||
export const sentryDSN =
|
export const sentryDSN =
|
||||||
'https://409f09bcb7af47928d3e0f46b78987f3@o1082494.ingest.sentry.io/4504236622217216';
|
'https://409f09bcb7af47928d3e0f46b78987f3@o1082494.ingest.sentry.io/4504236622217216';
|
||||||
@@ -1879,7 +1879,8 @@ export async function pushToRegistry(
|
|||||||
export function generateSecrets(
|
export function generateSecrets(
|
||||||
secrets: Array<any>,
|
secrets: Array<any>,
|
||||||
pullmergeRequestId: string,
|
pullmergeRequestId: string,
|
||||||
isBuild = false
|
isBuild = false,
|
||||||
|
port = null
|
||||||
): Array<string> {
|
): Array<string> {
|
||||||
const envs = [];
|
const envs = [];
|
||||||
const isPRMRSecret = secrets.filter((s) => s.isPRMRSecret);
|
const isPRMRSecret = secrets.filter((s) => s.isPRMRSecret);
|
||||||
@@ -1918,6 +1919,13 @@ export function generateSecrets(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const portFound = envs.filter((env) => env.startsWith('PORT'));
|
||||||
|
if (portFound.length === 0 && port && !isBuild) {
|
||||||
|
envs.push(`PORT=${port}`);
|
||||||
|
}
|
||||||
|
const nodeEnv = envs.filter((env) => env.startsWith('NODE_ENV'));
|
||||||
|
if (nodeEnv.length === 0 && !isBuild) {
|
||||||
|
envs.push(`NODE_ENV=production`);
|
||||||
|
}
|
||||||
return envs;
|
return envs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -569,10 +569,12 @@ export async function restartApplication(
|
|||||||
} = application;
|
} = application;
|
||||||
let location = null;
|
let location = null;
|
||||||
|
|
||||||
let envs = ['NODE_ENV=production', `PORT=${port}`];
|
let envs = [];
|
||||||
if (secrets.length > 0) {
|
if (secrets.length > 0) {
|
||||||
envs = [...envs, ...generateSecrets(secrets, pullmergeRequestId)];
|
envs = [...envs, ...generateSecrets(secrets, pullmergeRequestId, false, port)];
|
||||||
}
|
}
|
||||||
|
console.log(envs);
|
||||||
|
|
||||||
const { workdir } = await createDirectories({ repository, buildId });
|
const { workdir } = await createDirectories({ repository, buildId });
|
||||||
const labels = [];
|
const labels = [];
|
||||||
let image = null;
|
let image = null;
|
||||||
@@ -659,6 +661,7 @@ export async function restartApplication(
|
|||||||
},
|
},
|
||||||
volumes: Object.assign({}, ...composeVolumes)
|
volumes: Object.assign({}, ...composeVolumes)
|
||||||
};
|
};
|
||||||
|
console.log(yaml.dump(composeFile));
|
||||||
await fs.writeFile(`${workdir}/docker-compose.yml`, yaml.dump(composeFile));
|
await fs.writeFile(`${workdir}/docker-compose.yml`, yaml.dump(composeFile));
|
||||||
try {
|
try {
|
||||||
await executeCommand({ dockerId, command: `docker stop -t 0 ${id}` });
|
await executeCommand({ dockerId, command: `docker stop -t 0 ${id}` });
|
||||||
@@ -1370,9 +1373,9 @@ export async function restartPreview(
|
|||||||
exposePort
|
exposePort
|
||||||
} = application;
|
} = application;
|
||||||
|
|
||||||
let envs = ['NODE_ENV=production', `PORT=${port}`];
|
let envs = [];
|
||||||
if (secrets.length > 0) {
|
if (secrets.length > 0) {
|
||||||
envs = [...envs, ...generateSecrets(secrets, pullmergeRequestId)];
|
envs = [...envs, ...generateSecrets(secrets, pullmergeRequestId, false, port)];
|
||||||
}
|
}
|
||||||
const { workdir } = await createDirectories({ repository, buildId });
|
const { workdir } = await createDirectories({ repository, buildId });
|
||||||
const labels = [];
|
const labels = [];
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "coolify",
|
"name": "coolify",
|
||||||
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
||||||
"version": "3.12.3",
|
"version": "3.12.4",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": "github:coollabsio/coolify",
|
"repository": "github:coollabsio/coolify",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Reference in New Issue
Block a user