updates
This commit is contained in:
parent
17badf95dc
commit
c578fa63e5
@ -60,6 +60,7 @@ export async function getTemplates() {
|
|||||||
"variables": [
|
"variables": [
|
||||||
{
|
{
|
||||||
"id": "$$config_weblate_site_domain",
|
"id": "$$config_weblate_site_domain",
|
||||||
|
"main":"$$id",
|
||||||
"name": "WEBLATE_SITE_DOMAIN",
|
"name": "WEBLATE_SITE_DOMAIN",
|
||||||
"label": "Weblate Domain",
|
"label": "Weblate Domain",
|
||||||
"defaultValue": "$$generate_domain",
|
"defaultValue": "$$generate_domain",
|
||||||
@ -67,6 +68,7 @@ export async function getTemplates() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "$$secret_weblate_admin_password",
|
"id": "$$secret_weblate_admin_password",
|
||||||
|
"main":"$$id",
|
||||||
"name": "WEBLATE_ADMIN_PASSWORD",
|
"name": "WEBLATE_ADMIN_PASSWORD",
|
||||||
"label": "Weblate Admin Password",
|
"label": "Weblate Admin Password",
|
||||||
"defaultValue": "$$generate_password",
|
"defaultValue": "$$generate_password",
|
||||||
@ -84,6 +86,7 @@ export async function getTemplates() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "$$config_postgres_user",
|
"id": "$$config_postgres_user",
|
||||||
|
"main":"$$id-postgresql",
|
||||||
"name": "POSTGRES_USER",
|
"name": "POSTGRES_USER",
|
||||||
"label": "PostgreSQL User",
|
"label": "PostgreSQL User",
|
||||||
"defaultValue": "$$generate_username",
|
"defaultValue": "$$generate_username",
|
||||||
@ -91,6 +94,7 @@ export async function getTemplates() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "$$secret_postgres_password",
|
"id": "$$secret_postgres_password",
|
||||||
|
"main":"$$id-postgresql",
|
||||||
"name": "POSTGRES_PASSWORD",
|
"name": "POSTGRES_PASSWORD",
|
||||||
"label": "PostgreSQL Password",
|
"label": "PostgreSQL Password",
|
||||||
"defaultValue": "$$generate_password(32)",
|
"defaultValue": "$$generate_password(32)",
|
||||||
@ -112,6 +116,7 @@ export async function getTemplates() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "$$config_postgres_db",
|
"id": "$$config_postgres_db",
|
||||||
|
"main":"$$id-postgresql",
|
||||||
"name": "POSTGRES_DB",
|
"name": "POSTGRES_DB",
|
||||||
"label": "PostgreSQL Database",
|
"label": "PostgreSQL Database",
|
||||||
"defaultValue": "weblate",
|
"defaultValue": "weblate",
|
||||||
@ -700,7 +705,7 @@ export async function getTemplates() {
|
|||||||
{
|
{
|
||||||
"id": "$$config__app_influxdb_host",
|
"id": "$$config__app_influxdb_host",
|
||||||
"name": "_APP_INFLUXDB_HOST",
|
"name": "_APP_INFLUXDB_HOST",
|
||||||
"label": "",
|
"label": "InfluxDB | _APP_INFLUXDB_HOST",
|
||||||
"defaultValue": "$$id-influxdb",
|
"defaultValue": "$$id-influxdb",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
@ -818,7 +823,7 @@ export async function getTemplates() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "$$config__app_redis_host",
|
"id": "$$config__app_redis_host",
|
||||||
"name": "_APP_REDIS_HOST",
|
"name": "Redis | _APP_REDIS_HOST",
|
||||||
"label": "",
|
"label": "",
|
||||||
"defaultValue": "$$id-redis",
|
"defaultValue": "$$id-redis",
|
||||||
"description": ""
|
"description": ""
|
||||||
@ -846,7 +851,7 @@ export async function getTemplates() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "$$config__app_db_host",
|
"id": "$$config__app_db_host",
|
||||||
"name": "_APP_DB_HOST",
|
"name": "MariaDB | _APP_DB_HOST",
|
||||||
"label": "",
|
"label": "",
|
||||||
"defaultValue": "$$id-mariadb",
|
"defaultValue": "$$id-mariadb",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
@ -125,6 +125,7 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
|
|||||||
name: value.name,
|
name: value.name,
|
||||||
image: value.image,
|
image: value.image,
|
||||||
environment: [],
|
environment: [],
|
||||||
|
fqdns: [],
|
||||||
proxy: {}
|
proxy: {}
|
||||||
}
|
}
|
||||||
if (value.environment?.length > 0) {
|
if (value.environment?.length > 0) {
|
||||||
@ -134,14 +135,14 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
|
|||||||
const label = variable?.label
|
const label = variable?.label
|
||||||
const description = variable?.description
|
const description = variable?.description
|
||||||
const defaultValue = variable?.defaultValue
|
const defaultValue = variable?.defaultValue
|
||||||
|
const main = variable?.main || '$$id'
|
||||||
const extras = variable?.extras
|
const extras = variable?.extras
|
||||||
if (envValue.startsWith('$$config') || extras?.isVisibleOnUI) {
|
if (envValue.startsWith('$$config') || extras?.isVisibleOnUI) {
|
||||||
if (envValue.startsWith('$$config_coolify')) {
|
if (envValue.startsWith('$$config_coolify')) {
|
||||||
continue
|
continue
|
||||||
console.log({ envValue, envKey })
|
|
||||||
}
|
}
|
||||||
parsedTemplate[realKey].environment.push(
|
parsedTemplate[realKey].environment.push(
|
||||||
{ name: envKey, value: envValue, label, description, defaultValue, extras }
|
{ name: envKey, value: envValue, main, label, description, defaultValue, extras }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,7 +155,7 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
|
|||||||
if (variable) {
|
if (variable) {
|
||||||
const { name, label, description, defaultValue, extras } = variable
|
const { name, label, description, defaultValue, extras } = variable
|
||||||
const found = await prisma.serviceSetting.findFirst({ where: { variableName: proxyValue.domain } })
|
const found = await prisma.serviceSetting.findFirst({ where: { variableName: proxyValue.domain } })
|
||||||
parsedTemplate[realKey].environment.push(
|
parsedTemplate[realKey].fqdns.push(
|
||||||
{ name, value: found.value || '', label, description, defaultValue, extras }
|
{ name, value: found.value || '', label, description, defaultValue, extras }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -163,6 +164,7 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
parsedTemplate = foundTemplate
|
parsedTemplate = foundTemplate
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let service: any;
|
export let service: any;
|
||||||
export let readOnly: any;
|
|
||||||
export let template: any;
|
export let template: any;
|
||||||
import cuid from 'cuid';
|
import cuid from 'cuid';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
@ -19,7 +18,6 @@
|
|||||||
import { get, post } from '$lib/api';
|
import { get, post } from '$lib/api';
|
||||||
import { errorNotification, getDomain } from '$lib/common';
|
import { errorNotification, getDomain } from '$lib/common';
|
||||||
import { t } from '$lib/translations';
|
import { t } from '$lib/translations';
|
||||||
import Select from 'svelte-select';
|
|
||||||
import {
|
import {
|
||||||
appSession,
|
appSession,
|
||||||
status,
|
status,
|
||||||
@ -54,9 +52,7 @@
|
|||||||
let nonWWWDomain = service.fqdn && getDomain(service.fqdn).replace(/^www\./, '');
|
let nonWWWDomain = service.fqdn && getDomain(service.fqdn).replace(/^www\./, '');
|
||||||
let isNonWWWDomainOK = false;
|
let isNonWWWDomainOK = false;
|
||||||
let isWWWDomainOK = false;
|
let isWWWDomainOK = false;
|
||||||
let secondaryFQDNs = service.serviceSetting.filter((setting) =>
|
|
||||||
setting.name.startsWith('COOLIFY_FQDN')
|
|
||||||
);
|
|
||||||
async function isDNSValid(domain: any, isWWW: any) {
|
async function isDNSValid(domain: any, isWWW: any) {
|
||||||
try {
|
try {
|
||||||
await get(`/services/${id}/check?domain=${domain}`);
|
await get(`/services/${id}/check?domain=${domain}`);
|
||||||
@ -76,7 +72,6 @@
|
|||||||
async function handleSubmit(e: any) {
|
async function handleSubmit(e: any) {
|
||||||
if (loading.save) return;
|
if (loading.save) return;
|
||||||
loading.save = true;
|
loading.save = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// await post(`/services/${id}/check`, {
|
// await post(`/services/${id}/check`, {
|
||||||
// fqdn: service.fqdn,
|
// fqdn: service.fqdn,
|
||||||
@ -310,12 +305,13 @@
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#each secondaryFQDNs as fqdn}
|
{#each Object.keys(template) as oneService}
|
||||||
{JSON.stringify(fqdn)}
|
{#each template[oneService].fqdns as fqdn}
|
||||||
<div class="grid grid-cols-2 items-center">
|
<div class="grid grid-cols-2 items-center py-1">
|
||||||
<label class="h-10" for={fqdn.name}>{fqdn.label || fqdn.name}</label>
|
<label for={fqdn.name}>{fqdn.label || fqdn.name}</label>
|
||||||
<input class="w-full" name={fqdn.name} id={fqdn.name} value={fqdn.value} />
|
<input class="w-full" name={fqdn.name} id={fqdn.name} bind:value={fqdn.value} />
|
||||||
</div>
|
</div>
|
||||||
|
{/each}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{#if forceSave}
|
{#if forceSave}
|
||||||
@ -401,83 +397,85 @@
|
|||||||
<div class="grid grid-flow-row gap-2 px-4">
|
<div class="grid grid-flow-row gap-2 px-4">
|
||||||
{#if template[oneService].environment.length > 0}
|
{#if template[oneService].environment.length > 0}
|
||||||
{#each template[oneService].environment as variable}
|
{#each template[oneService].environment as variable}
|
||||||
<div class="grid grid-cols-2 items-center gap-2">
|
{#if variable.main === oneService}
|
||||||
<label class="h-10" for={variable.name}>{variable.label || variable.name}</label>
|
<div class="grid grid-cols-2 items-center gap-2">
|
||||||
{#if variable.defaultValue === '$$generate_fqdn'}
|
<label class="h-10" for={variable.name}>{variable.label || variable.name}</label>
|
||||||
<input
|
{#if variable.defaultValue === '$$generate_fqdn'}
|
||||||
class="w-full"
|
<input
|
||||||
disabled
|
class="w-full"
|
||||||
readonly
|
disabled
|
||||||
name={variable.name}
|
readonly
|
||||||
id={variable.name}
|
|
||||||
value={service.fqdn}
|
|
||||||
/>
|
|
||||||
{:else if variable.defaultValue === '$$generate_domain'}
|
|
||||||
<input
|
|
||||||
class="w-full"
|
|
||||||
disabled
|
|
||||||
readonly
|
|
||||||
name={variable.name}
|
|
||||||
id={variable.name}
|
|
||||||
value={getDomain(service.fqdn)}
|
|
||||||
/>
|
|
||||||
{:else if variable.defaultValue === '$$generate_network'}
|
|
||||||
<input
|
|
||||||
class="w-full"
|
|
||||||
disabled
|
|
||||||
readonly
|
|
||||||
name={variable.name}
|
|
||||||
id={variable.name}
|
|
||||||
value={service.destinationDocker.network}
|
|
||||||
/>
|
|
||||||
{:else if variable.defaultValue === 'true' || variable.defaultValue === 'false'}
|
|
||||||
{#if variable.value === 'true' || variable.value === 'false'}
|
|
||||||
<select
|
|
||||||
class="w-full font-normal"
|
|
||||||
readonly={isDisabled}
|
|
||||||
disabled={isDisabled}
|
|
||||||
id={variable.name}
|
|
||||||
name={variable.name}
|
name={variable.name}
|
||||||
bind:value={variable.value}
|
id={variable.name}
|
||||||
form="saveForm"
|
value={service.fqdn}
|
||||||
>
|
/>
|
||||||
<option value="true">true</option>
|
{:else if variable.defaultValue === '$$generate_domain'}
|
||||||
<option value="false"> false</option>
|
<input
|
||||||
</select>
|
class="w-full"
|
||||||
|
disabled
|
||||||
|
readonly
|
||||||
|
name={variable.name}
|
||||||
|
id={variable.name}
|
||||||
|
value={getDomain(service.fqdn)}
|
||||||
|
/>
|
||||||
|
{:else if variable.defaultValue === '$$generate_network'}
|
||||||
|
<input
|
||||||
|
class="w-full"
|
||||||
|
disabled
|
||||||
|
readonly
|
||||||
|
name={variable.name}
|
||||||
|
id={variable.name}
|
||||||
|
value={service.destinationDocker.network}
|
||||||
|
/>
|
||||||
|
{:else if variable.defaultValue === 'true' || variable.defaultValue === 'false'}
|
||||||
|
{#if variable.value === 'true' || variable.value === 'false'}
|
||||||
|
<select
|
||||||
|
class="w-full font-normal"
|
||||||
|
readonly={isDisabled}
|
||||||
|
disabled={isDisabled}
|
||||||
|
id={variable.name}
|
||||||
|
name={variable.name}
|
||||||
|
bind:value={variable.value}
|
||||||
|
form="saveForm"
|
||||||
|
>
|
||||||
|
<option value="true">true</option>
|
||||||
|
<option value="false"> false</option>
|
||||||
|
</select>
|
||||||
|
{:else}
|
||||||
|
<select
|
||||||
|
class="w-full font-normal"
|
||||||
|
readonly={isDisabled}
|
||||||
|
disabled={isDisabled}
|
||||||
|
id={variable.name}
|
||||||
|
name={variable.name}
|
||||||
|
bind:value={variable.defaultValue}
|
||||||
|
form="saveForm"
|
||||||
|
>
|
||||||
|
<option value="true">true</option>
|
||||||
|
<option value="false"> false</option>
|
||||||
|
</select>
|
||||||
|
{/if}
|
||||||
|
{:else if variable.defaultValue === '$$generate_password' || variable.defaultValue === '$$generate_passphrase'}
|
||||||
|
<CopyPasswordField
|
||||||
|
isPasswordField
|
||||||
|
readonly
|
||||||
|
disabled
|
||||||
|
name={variable.name}
|
||||||
|
id={variable.name}
|
||||||
|
value={variable.value}
|
||||||
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<select
|
<CopyPasswordField
|
||||||
class="w-full font-normal"
|
required={variable?.extras?.required}
|
||||||
readonly={isDisabled}
|
readonly={isDisabled}
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
id={variable.name}
|
|
||||||
name={variable.name}
|
name={variable.name}
|
||||||
bind:value={variable.defaultValue}
|
id={variable.name}
|
||||||
form="saveForm"
|
value={variable.value}
|
||||||
>
|
/>
|
||||||
<option value="true">true</option>
|
|
||||||
<option value="false"> false</option>
|
|
||||||
</select>
|
|
||||||
{/if}
|
{/if}
|
||||||
{:else if variable.defaultValue === '$$generate_password' || variable.defaultValue === '$$generate_passphrase'}
|
</div>
|
||||||
<CopyPasswordField
|
{/if}
|
||||||
isPasswordField
|
|
||||||
readonly
|
|
||||||
disabled
|
|
||||||
name={variable.name}
|
|
||||||
id={variable.name}
|
|
||||||
value={variable.value}
|
|
||||||
/>
|
|
||||||
{:else}
|
|
||||||
<CopyPasswordField
|
|
||||||
required={variable?.extras?.required}
|
|
||||||
readonly={isDisabled}
|
|
||||||
disabled={isDisabled}
|
|
||||||
name={variable.name}
|
|
||||||
id={variable.name}
|
|
||||||
value={variable.value}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user