diff --git a/package.json b/package.json index b34df3e5a..158b144cf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "coolify", "description": "An open-source & self-hostable Heroku / Netlify alternative.", - "version": "2.0.5", + "version": "2.0.6", "license": "AGPL-3.0", "scripts": { "dev": "docker compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0", diff --git a/prisma/migrations/20220212142309_unique_secret_by_application/migration.sql b/prisma/migrations/20220212142309_unique_secret_by_application/migration.sql new file mode 100644 index 000000000..da4aa8e7c --- /dev/null +++ b/prisma/migrations/20220212142309_unique_secret_by_application/migration.sql @@ -0,0 +1,11 @@ +/* + Warnings: + + - A unique constraint covering the columns `[name,applicationId]` on the table `Secret` will be added. If there are existing duplicate values, this will fail. + +*/ +-- DropIndex +DROP INDEX "Secret_name_key"; + +-- CreateIndex +CREATE UNIQUE INDEX "Secret_name_applicationId_key" ON "Secret"("name", "applicationId"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index b12e29fc5..b064d09ab 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -105,13 +105,15 @@ model ApplicationSettings { model Secret { id String @id @default(cuid()) - name String @unique + name String value String isBuildSecret Boolean @default(false) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt application Application @relation(fields: [applicationId], references: [id]) applicationId String + + @@unique([name, applicationId]) } model BuildLog { diff --git a/src/lib/database/users.ts b/src/lib/database/users.ts index 7b15ff4d2..20b1a4aab 100644 --- a/src/lib/database/users.ts +++ b/src/lib/database/users.ts @@ -28,12 +28,12 @@ export async function login({ email, password }) { console.log('Network created'); }) .catch(() => { - console.log('Network already exists'); + console.log('Network already exists.'); }); startCoolifyProxy('/var/run/docker.sock') .then(() => { - console.log('Coolify Proxy Started'); + console.log('Coolify Proxy started.'); }) .catch((err) => { console.log(err); diff --git a/src/routes/applications/[id]/secrets/_Secret.svelte b/src/routes/applications/[id]/secrets/_Secret.svelte index fc24a1c63..90a1c2ffa 100644 --- a/src/routes/applications/[id]/secrets/_Secret.svelte +++ b/src/routes/applications/[id]/secrets/_Secret.svelte @@ -6,14 +6,19 @@ import { page } from '$app/stores'; import { del, post } from '$lib/api'; import { errorNotification } from '$lib/form'; + import { createEventDispatcher } from 'svelte'; + + const dispatch = createEventDispatcher(); - if (name) value = 'ENCRYPTED'; const { id } = $page.params; - async function removeSecret() { try { await del(`/applications/${id}/secrets.json`, { name }); - return window.location.reload(); + dispatch('refresh'); + if (isNewSecret) { + name = ''; + value = ''; + } } catch ({ error }) { return errorNotification(error); } @@ -21,7 +26,11 @@ async function saveSecret() { try { await post(`/applications/${id}/secrets.json`, { name, value, isBuildSecret }); - return window.location.reload(); + dispatch('refresh'); + if (isNewSecret) { + name = ''; + value = ''; + } } catch ({ error }) { return errorNotification(error); } @@ -33,101 +42,85 @@ } -
Name | +Value | +Need during buildtime? | ++ |
---|---|---|---|