@@ -94,6 +94,16 @@ async function main() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// Set new preview secrets
|
||||||
|
const secrets = await prisma.secret.findMany({ where: { isPRMRSecret: false } })
|
||||||
|
if (secrets.length > 0) {
|
||||||
|
for (const secret of secrets) {
|
||||||
|
const previewSecrets = await prisma.secret.findMany({ where: { id: secret.id, isPRMRSecret: true } })
|
||||||
|
if (previewSecrets.length === 0) {
|
||||||
|
await prisma.secret.create({ data: { ...secret, id: undefined, isPRMRSecret: true } })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
main()
|
main()
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
@@ -21,7 +21,7 @@ import { scheduler } from './scheduler';
|
|||||||
import { supportedServiceTypesAndVersions } from './services/supportedVersions';
|
import { supportedServiceTypesAndVersions } from './services/supportedVersions';
|
||||||
import { includeServices } from './services/common';
|
import { includeServices } from './services/common';
|
||||||
|
|
||||||
export const version = '3.10.5';
|
export const version = '3.10.6';
|
||||||
export const isDev = process.env.NODE_ENV === 'development';
|
export const isDev = process.env.NODE_ENV === 'development';
|
||||||
|
|
||||||
const algorithm = 'aes-256-ctr';
|
const algorithm = 'aes-256-ctr';
|
||||||
|
@@ -15,7 +15,6 @@ import { checkContainer, formatLabelsOnDocker, isContainerExited, removeContaine
|
|||||||
import type { FastifyRequest } from 'fastify';
|
import type { FastifyRequest } from 'fastify';
|
||||||
import type { GetImages, CancelDeployment, CheckDNS, CheckRepository, DeleteApplication, DeleteSecret, DeleteStorage, GetApplicationLogs, GetBuildIdLogs, SaveApplication, SaveApplicationSettings, SaveApplicationSource, SaveDeployKey, SaveDestination, SaveSecret, SaveStorage, DeployApplication, CheckDomain, StopPreviewApplication, RestartPreviewApplication, GetBuilds } from './types';
|
import type { GetImages, CancelDeployment, CheckDNS, CheckRepository, DeleteApplication, DeleteSecret, DeleteStorage, GetApplicationLogs, GetBuildIdLogs, SaveApplication, SaveApplicationSettings, SaveApplicationSource, SaveDeployKey, SaveDestination, SaveSecret, SaveStorage, DeployApplication, CheckDomain, StopPreviewApplication, RestartPreviewApplication, GetBuilds } from './types';
|
||||||
import { OnlyId } from '../../../../types';
|
import { OnlyId } from '../../../../types';
|
||||||
import path from 'node:path';
|
|
||||||
|
|
||||||
function filterObject(obj, callback) {
|
function filterObject(obj, callback) {
|
||||||
return Object.fromEntries(Object.entries(obj).
|
return Object.fromEntries(Object.entries(obj).
|
||||||
@@ -326,7 +325,7 @@ export async function saveApplicationSettings(request: FastifyRequest<SaveApplic
|
|||||||
where: { id },
|
where: { id },
|
||||||
data: { fqdn: isBot ? null : undefined, settings: { update: { debug, previews, dualCerts, autodeploy, isBot, isDBBranching, isCustomSSL } } },
|
data: { fqdn: isBot ? null : undefined, settings: { update: { debug, previews, dualCerts, autodeploy, isBot, isDBBranching, isCustomSSL } } },
|
||||||
include: { destinationDocker: true }
|
include: { destinationDocker: true }
|
||||||
});
|
});
|
||||||
return reply.code(201).send();
|
return reply.code(201).send();
|
||||||
} catch ({ status, message }) {
|
} catch ({ status, message }) {
|
||||||
return errorHandler({ status, message })
|
return errorHandler({ status, message })
|
||||||
@@ -817,10 +816,15 @@ export async function getSecrets(request: FastifyRequest<OnlyId>) {
|
|||||||
export async function updatePreviewSecret(request: FastifyRequest<SaveSecret>, reply: FastifyReply) {
|
export async function updatePreviewSecret(request: FastifyRequest<SaveSecret>, reply: FastifyReply) {
|
||||||
try {
|
try {
|
||||||
const { id } = request.params
|
const { id } = request.params
|
||||||
const { name, value } = request.body
|
let { name, value } = request.body
|
||||||
|
if (value) {
|
||||||
|
value = encrypt(value.trim())
|
||||||
|
} else {
|
||||||
|
value = ''
|
||||||
|
}
|
||||||
await prisma.secret.updateMany({
|
await prisma.secret.updateMany({
|
||||||
where: { applicationId: id, name, isPRMRSecret: true },
|
where: { applicationId: id, name, isPRMRSecret: true },
|
||||||
data: { value: encrypt(value.trim()) }
|
data: { value }
|
||||||
});
|
});
|
||||||
return reply.code(201).send()
|
return reply.code(201).send()
|
||||||
} catch ({ status, message }) {
|
} catch ({ status, message }) {
|
||||||
|
@@ -3,7 +3,7 @@ import { addToast } from '$lib/store';
|
|||||||
export const asyncSleep = (delay: number) =>
|
export const asyncSleep = (delay: number) =>
|
||||||
new Promise((resolve) => setTimeout(resolve, delay));
|
new Promise((resolve) => setTimeout(resolve, delay));
|
||||||
|
|
||||||
export function errorNotification(error: any): void {
|
export function errorNotification(error: any | { message: string }): void {
|
||||||
if (error.message) {
|
if (error.message) {
|
||||||
if (error.message === 'Cannot read properties of undefined (reading \'postMessage\')') {
|
if (error.message === 'Cannot read properties of undefined (reading \'postMessage\')') {
|
||||||
return addToast({
|
return addToast({
|
||||||
|
@@ -39,8 +39,8 @@
|
|||||||
|
|
||||||
async function addNewSecret() {
|
async function addNewSecret() {
|
||||||
try {
|
try {
|
||||||
if (!name) return errorNotification(`${t.get('forms.name')} ${t.get('forms.is_required')}`);
|
if (!name) return errorNotification({ message: 'Name is required.' });
|
||||||
if (!value) return errorNotification(`${t.get('forms.value')} ${t.get('forms.is_required')}`);
|
if (!value) return errorNotification({ message: 'Value is required.' });
|
||||||
await post(`/applications/${id}/secrets`, {
|
await post(`/applications/${id}/secrets`, {
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
changeIsBuildSecret = false
|
changeIsBuildSecret = false
|
||||||
}: { changeIsBuildSecret?: boolean } = {}) {
|
}: { changeIsBuildSecret?: boolean } = {}) {
|
||||||
if (changeIsBuildSecret) isBuildSecret = !isBuildSecret;
|
if (changeIsBuildSecret) isBuildSecret = !isBuildSecret;
|
||||||
if (isNewSecret) return
|
if (isNewSecret) return;
|
||||||
try {
|
try {
|
||||||
await put(`/applications/${id}/secrets`, {
|
await put(`/applications/${id}/secrets`, {
|
||||||
name,
|
name,
|
||||||
|
@@ -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.10.5",
|
"version": "3.10.6",
|
||||||
"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