diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts index 0d452a320..d6e30aa03 100644 --- a/apps/api/src/lib/common.ts +++ b/apps/api/src/lib/common.ts @@ -1977,6 +1977,12 @@ export async function cleanupDockerStorage(dockerId, lowDiskSpace, force) { } catch (error) { //console.log(error); } + // Cleanup build caches + try { + await executeDockerCmd({ dockerId, command: `docker builder prune -a -f` }) + } catch (error) { + //console.log(error); + } } } @@ -2022,3 +2028,27 @@ export function defaultComposeConfiguration(network: string): any { } } } +export function decryptApplication(application: any) { + if (application) { + if (application?.gitSource?.githubApp?.clientSecret) { + application.gitSource.githubApp.clientSecret = decrypt(application.gitSource.githubApp.clientSecret) || null; + } + if (application?.gitSource?.githubApp?.webhookSecret) { + application.gitSource.githubApp.webhookSecret = decrypt(application.gitSource.githubApp.webhookSecret) || null; + } + if (application?.gitSource?.githubApp?.privateKey) { + application.gitSource.githubApp.privateKey = decrypt(application.gitSource.githubApp.privateKey) || null; + } + if (application?.gitSource?.gitlabApp?.appSecret) { + application.gitSource.gitlabApp.appSecret = decrypt(application.gitSource.gitlabApp.appSecret) || null; + } + if (application?.secrets.length > 0) { + application.secrets = application.secrets.map((s: any) => { + s.value = decrypt(s.value) || null + return s; + }); + } + + return application; + } +} \ No newline at end of file