This commit is contained in:
Andras Bacsai 2022-10-28 20:30:34 +00:00
parent 4b35db6291
commit bdc62a007e
6 changed files with 24 additions and 15 deletions

View File

@ -2059,7 +2059,7 @@
name: DATABASE_URL
label: Database URL for PostgreSQL
defaultValue: >-
postgresql://$$config_postgres_user:$$secret_postgres_password@$$id-postgresql:5432/$$config_postgres_db
postgresql://$$config_postgres_user:$$secret_postgres_password@$$id-postgresql:5432/$$config_postgres_db?sslmode=disable
description: ''
- id: $$secret_jwt_secret
name: JWT_SECRET
@ -2076,6 +2076,7 @@
label: Mailgun API Key
defaultValue: ''
description: ''
showOnConfiguration: true
- id: $$config_email_mailgun_region
name: EMAIL_MAILGUN_REGION
label: Mailgun Region
@ -2106,6 +2107,7 @@
label: SMTP Password
defaultValue: ''
description: ''
showOnConfiguration: true
- id: $$config_email_smtp_enable_starttls
name: EMAIL_SMTP_ENABLE_STARTTLS
label: SMTP Enable StartTLS

View File

@ -47,7 +47,8 @@ export async function startService(request: FastifyRequest<ServiceStartStop>, fa
if (arm) {
if (template.services[s]?.environmentArm?.length > 0) {
for (const environment of template.services[s].environmentArm) {
const [env, value] = environment.split("=");
let [env, ...value] = environment.split("=");
value = value.join("=")
if (!value.startsWith('$$secret') && value !== '') {
newEnvironments.push(`${env}=${value}`)
}
@ -56,7 +57,8 @@ export async function startService(request: FastifyRequest<ServiceStartStop>, fa
} else {
if (template.services[s]?.environment?.length > 0) {
for (const environment of template.services[s].environment) {
const [env, value] = environment.split("=");
let [env, ...value] = environment.split("=");
value = value.join("=")
if (!value.startsWith('$$secret') && value !== '') {
newEnvironments.push(`${env}=${value}`)
}

View File

@ -128,7 +128,8 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
}
if (value.environment?.length > 0) {
for (const env of value.environment) {
const [envKey, envValue] = env.split('=')
let [envKey, ...envValue] = env.split('=')
envValue = envValue.join("=")
const variable = foundTemplate.variables.find(v => v.name === envKey) || foundTemplate.variables.find(v => v.id === envValue)
const id = variable.id.replaceAll('$$', '')
const label = variable?.label
@ -495,14 +496,16 @@ export async function saveService(request: FastifyRequest<SaveService>, reply: F
const foundTemplate = templates.find(t => fixType(t.type) === fixType(service.type))
for (const setting of serviceSetting) {
let { id: settingId, name, value, changed = false, isNew = false, variableName } = setting
if (changed) {
await prisma.serviceSetting.update({ where: { id: settingId }, data: { value } })
}
if (isNew) {
if (!variableName) {
variableName = foundTemplate.variables.find(v => v.name === name).id
if (value) {
if (changed) {
await prisma.serviceSetting.update({ where: { id: settingId }, data: { value } })
}
if (isNew) {
if (!variableName) {
variableName = foundTemplate.variables.find(v => v.name === name).id
}
await prisma.serviceSetting.create({ data: { name, value, variableName, service: { connect: { id } } } })
}
await prisma.serviceSetting.create({ data: { name, value, variableName, service: { connect: { id } } } })
}
}
await prisma.service.update({
@ -547,7 +550,6 @@ export async function saveServiceSecret(request: FastifyRequest<SaveServiceSecre
try {
const { id } = request.params
let { name, value, isNew } = request.body
if (isNew) {
const found = await prisma.serviceSecret.findFirst({ where: { name, serviceId: id } });
if (found) {

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,8 @@
import { dev } from '$app/env';
import cuid from 'cuid';
import Cookies from 'js-cookie';
import {getAPIUrl} from '$lib/api';
import {getDomain} from '$lib/common'
import { writable, readable, type Writable } from 'svelte/store';
interface AppSession {
@ -174,7 +176,8 @@ export const connect = () => {
if (token) {
let url = `wss://${window.location.hostname}/realtime`
if (dev) {
url = "ws://localhost:3001/realtime"
const apiUrl = getDomain(getAPIUrl())
url = `ws://${apiUrl}/realtime`
}
const ws = new WebSocket(url);
ws.addEventListener("message", (message: any) => {

View File

@ -47,7 +47,7 @@ export async function saveForm(formData: any, service: any) {
const baseCoolifySetting = ['name', 'fqdn', 'exposePort', 'version'];
for (let field of formData) {
const [key, value] = field;
if (secrets.includes(key)) {
if (secrets.includes(key) && value) {
await post(`/services/${service.id}/secrets`, {
name: key,
value,