diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts index ce8b8051d..68afa8861 100644 --- a/apps/api/src/lib/common.ts +++ b/apps/api/src/lib/common.ts @@ -17,7 +17,7 @@ import { checkContainer, removeContainer } from './docker'; import { day } from './dayjs'; import * as serviceFields from './serviceFields' -export const version = '3.3.2'; +export const version = '3.3.3'; export const isDev = process.env.NODE_ENV === 'development'; const algorithm = 'aes-256-ctr'; @@ -96,17 +96,23 @@ export const base64Decode = (text: string): string => { }; export const decrypt = (hashString: string) => { if (hashString) { - const hash = JSON.parse(hashString); - const decipher = crypto.createDecipheriv( - algorithm, - process.env['COOLIFY_SECRET_KEY'], - Buffer.from(hash.iv, 'hex') - ); - const decrpyted = Buffer.concat([ - decipher.update(Buffer.from(hash.content, 'hex')), - decipher.final() - ]); - return decrpyted.toString(); + try { + const hash = JSON.parse(hashString); + const decipher = crypto.createDecipheriv( + algorithm, + process.env['COOLIFY_SECRET_KEY'], + Buffer.from(hash.iv, 'hex') + ); + const decrpyted = Buffer.concat([ + decipher.update(Buffer.from(hash.content, 'hex')), + decipher.final() + ]); + return decrpyted.toString(); + } catch (error) { + console.log({ decryptionError: error.message }) + return hashString + } + } }; export const encrypt = (text: string) => { @@ -867,6 +873,11 @@ export function generateDatabaseConfiguration(database: any, arch: string): } if (isARM(arch)) { configuration.volume = `${id}-${type}-data:/var/lib/postgresql`; + configuration.environmentVariables = { + POSTGRES_PASSWORD: dbUserPassword, + POSTGRES_USER: dbUser, + POSTGRES_DB: defaultDatabase + } } return configuration } else if (type === 'redis') { @@ -903,7 +914,7 @@ export function generateDatabaseConfiguration(database: any, arch: string): return configuration } } -export function isARM(arch) { +export function isARM(arch: string) { if (arch === 'arm' || arch === 'arm64') { return true } @@ -1226,7 +1237,6 @@ export async function startTraefikTCPProxy( } traefikUrl = `${ip}/webhooks/traefik/other.json` } - console.log(traefikUrl) const tcpProxy = { version: '3.8', services: { @@ -1291,6 +1301,7 @@ export async function getServiceFromDB({ id, teamId }: { id: string; teamId: str return s; }); } + body[type] = { ...body[type], ...getUpdateableFields(type, body[type]) } return { ...body, settings }; } diff --git a/apps/api/src/lib/serviceFields.ts b/apps/api/src/lib/serviceFields.ts index 89d6a9c70..9ddf37ba3 100644 --- a/apps/api/src/lib/serviceFields.ts +++ b/apps/api/src/lib/serviceFields.ts @@ -326,7 +326,7 @@ export const fider = [{ isBoolean: false, isEncrypted: true }, { - name: 'postgreslUser', + name: 'postgresqlUser', isEditable: false, isLowerCase: false, isNumber: false, diff --git a/apps/api/src/routes/api/v1/services/handlers.ts b/apps/api/src/routes/api/v1/services/handlers.ts index 8d07ac70b..a2c87092e 100644 --- a/apps/api/src/routes/api/v1/services/handlers.ts +++ b/apps/api/src/routes/api/v1/services/handlers.ts @@ -197,13 +197,11 @@ export async function getService(request: FastifyRequest) { const teamId = request.user.teamId; const { id } = request.params; const service = await getServiceFromDB({ id, teamId }); - const settings = await listSettings() if (!service) { throw { status: 404, message: 'Service not found.' } } return { - service, - settings + service } } catch ({ status, message }) { return errorHandler({ status, message }) diff --git a/csb.nix b/csb.nix index 2005806f9..b2b07e4de 100644 --- a/csb.nix +++ b/csb.nix @@ -1,7 +1,7 @@ with import {}; stdenv.mkDerivation { - name = "git"; + name = "environment"; buildInputs = [ git git-lfs diff --git a/package.json b/package.json index 9a11294f8..f02c854bb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "coolify", "description": "An open-source & self-hostable Heroku / Netlify alternative.", - "version": "3.3.2", + "version": "3.3.3", "license": "Apache-2.0", "repository": "github:coollabsio/coolify", "scripts": {