add length option to template

This commit is contained in:
Andras Bacsai
2022-10-17 14:55:28 +00:00
parent 8f660c0276
commit 9afb713df1
3 changed files with 45 additions and 41 deletions

View File

@@ -159,6 +159,9 @@ export default [
"label": "Secret Key Base",
"defaultValue": "$$generate_passphrase",
"description": "",
"details": {
"length":64
}
},
{
"id": "$$config_disable_auth",

View File

@@ -221,9 +221,11 @@ export async function saveServiceType(request: FastifyRequest<SaveServiceType>,
let { id: variableId } = variable;
if (variableId.startsWith('$$secret_')) {
if (variable.defaultValue === '$$generate_password') {
variable.value = generatePassword({});
const length = variable?.details['length'] || null
variable.value = generatePassword({length});
} else if (variable.defaultValue === '$$generate_passphrase') {
variable.value = cuid();
const length = variable?.details['length'] || null
variable.value = generatePassword({length});
}
}
if (variableId.startsWith('$$config_')) {

View File

@@ -135,7 +135,7 @@
<div class="text-xl font-bold tracking-tighter">Container not found / exited.</div>
{/if}
{:else}
<div class="relative w-full"></div>
<div class="relative w-full" />
<div class="flex justify-start sticky space-x-2 pb-2">
<button
on:click={followBuild}
@@ -176,7 +176,6 @@
<p>{log + '\n'}</p>
{/each}
</div>
</div>
{/if}
</div>
{/if}