This commit is contained in:
Andras Bacsai 2022-10-21 22:34:27 +02:00
parent a267ee40d2
commit 17badf95dc
2 changed files with 14 additions and 9 deletions

View File

@ -137,6 +137,7 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
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
console.log({ envValue, envKey }) console.log({ envValue, envKey })
} }
parsedTemplate[realKey].environment.push( parsedTemplate[realKey].environment.push(
@ -180,6 +181,9 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
if (service.serviceSetting.length > 0) { if (service.serviceSetting.length > 0) {
for (const setting of service.serviceSetting) { for (const setting of service.serviceSetting) {
const { value, variableName } = setting const { value, variableName } = setting
if (variableName.startsWith('$$config_coolify')) {
continue;
}
if (service.fqdn && value === '$$generate_fqdn') { if (service.fqdn && value === '$$generate_fqdn') {
strParsedTemplate = strParsedTemplate.replaceAll(variableName, service.fqdn) strParsedTemplate = strParsedTemplate.replaceAll(variableName, service.fqdn)
} else if (service.fqdn && value === '$$generate_domain') { } else if (service.fqdn && value === '$$generate_domain') {

View File

@ -54,7 +54,9 @@
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}`);
@ -308,13 +310,12 @@
required required
/> />
</div> </div>
{#each Object.keys(template) as oneService} {#each secondaryFQDNs as fqdn}
{#each template[oneService].environment.filter( (a) => a.name.startsWith('COOLIFY_FQDN_') ) as variable} {JSON.stringify(fqdn)}
<div class="grid grid-cols-2 items-center"> <div class="grid grid-cols-2 items-center">
<label class="h-10" for={variable.name}>{variable.label || variable.name}</label> <label class="h-10" for={fqdn.name}>{fqdn.label || fqdn.name}</label>
<input class="w-full" name={variable.name} id={variable.name} value={variable.value} /> <input class="w-full" name={fqdn.name} id={fqdn.name} value={fqdn.value} />
</div> </div>
{/each}
{/each} {/each}
</div> </div>
{#if forceSave} {#if forceSave}
@ -399,7 +400,7 @@
</div> </div>
<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.filter((a) => !a.name.startsWith('COOLIFY_FQDN_')) as variable} {#each template[oneService].environment as variable}
<div class="grid grid-cols-2 items-center gap-2"> <div class="grid grid-cols-2 items-center gap-2">
<label class="h-10" for={variable.name}>{variable.label || variable.name}</label> <label class="h-10" for={variable.name}>{variable.label || variable.name}</label>
{#if variable.defaultValue === '$$generate_fqdn'} {#if variable.defaultValue === '$$generate_fqdn'}