fix
This commit is contained in:
parent
462eea90c0
commit
a7e86d9afd
@ -111,19 +111,21 @@ export default [
|
|||||||
{
|
{
|
||||||
"id": "$$secret_name",
|
"id": "$$secret_name",
|
||||||
"label": "Admin Name",
|
"label": "Admin Name",
|
||||||
"defaultValue": "admin",
|
"defaultValue": "$$generate_username",
|
||||||
"description": "This is the admin username. Please change it.",
|
"description": "This is the admin username. Please change it.",
|
||||||
"validRegex": /^([^\s^\/])+$/
|
"validRegex": /^([^\s^\/])+$/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "$$secret_password",
|
"id": "$$secret_password",
|
||||||
"label": "Admin Password",
|
"label": "Admin Password",
|
||||||
|
"defaultValue":"$$generate_password",
|
||||||
"description": "This is the admin password. Please change it.",
|
"description": "This is the admin password. Please change it.",
|
||||||
"validRegex": /^([^\s^\/])+$/
|
"validRegex": /^([^\s^\/])+$/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "$$secret_secret_key_base",
|
"id": "$$secret_secret_key_base",
|
||||||
"label": "Secret Key Base",
|
"label": "Secret Key Base",
|
||||||
|
"defaultValue":"$$generate_passphrase",
|
||||||
"description": "",
|
"description": "",
|
||||||
"validRegex": /^([^\s^\/])+$/
|
"validRegex": /^([^\s^\/])+$/
|
||||||
},
|
},
|
||||||
@ -141,13 +143,6 @@ export default [
|
|||||||
"description": "",
|
"description": "",
|
||||||
"validRegex": /^([^\s^\/])+$/
|
"validRegex": /^([^\s^\/])+$/
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "$$secret_disable_registration",
|
|
||||||
"label": "Disable Registration",
|
|
||||||
"defaultValue": "true",
|
|
||||||
"description": "",
|
|
||||||
"validRegex": /^([^\s^\/])+$/
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "$$secret_postgresql_username",
|
"id": "$$secret_postgresql_username",
|
||||||
"label": "PostgreSQL Username",
|
"label": "PostgreSQL Username",
|
||||||
@ -158,7 +153,7 @@ export default [
|
|||||||
{
|
{
|
||||||
"id": "$$secret_postgresql_password",
|
"id": "$$secret_postgresql_password",
|
||||||
"label": "PostgreSQL Password",
|
"label": "PostgreSQL Password",
|
||||||
"defaultValue": "postgresql",
|
"defaultValue": "$$generate_password",
|
||||||
"description": "",
|
"description": "",
|
||||||
"validRegex": /^([^\s^\/])+$/
|
"validRegex": /^([^\s^\/])+$/
|
||||||
}
|
}
|
||||||
|
@ -157,9 +157,17 @@ export async function saveServiceType(request: FastifyRequest<SaveServiceType>,
|
|||||||
if (variableId.startsWith('$$secret_')) {
|
if (variableId.startsWith('$$secret_')) {
|
||||||
const secretName = variableId.replace('$$secret_', '');
|
const secretName = variableId.replace('$$secret_', '');
|
||||||
let secretValue = defaultValue || value || null;
|
let secretValue = defaultValue || value || null;
|
||||||
if (secretValue) secretValue = encrypt(secretValue);
|
if (defaultValue === '$$generate_password') {
|
||||||
|
secretValue = generatePassword({});
|
||||||
|
}
|
||||||
|
if (defaultValue === '$$generate_username') {
|
||||||
|
secretValue = cuid();
|
||||||
|
}
|
||||||
|
if (defaultValue === '$$generate_passphrase') {
|
||||||
|
secretValue = cuid();
|
||||||
|
}
|
||||||
await prisma.serviceSecret.create({
|
await prisma.serviceSecret.create({
|
||||||
data: { name: secretName, value: secretValue, service: { connect: { id } } }
|
data: { name: secretName, value: encrypt(secretValue), service: { connect: { id } } }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user