Files
dokploy/apps/dokploy/templates/activepieces/index.ts
T
2024-11-13 05:45:16 -05:00

40 lines
1.1 KiB
TypeScript

import {
type DomainSchema,
type Schema,
type Template,
generateRandomDomain,
} from "../utils";
export function generate(schema: Schema): Template {
const mainDomain = generateRandomDomain(schema);
const apiKey = Array.from({length: 32}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const encryptionKey = Array.from({length: 32}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const jwtSecret = Array.from({length: 32}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const postgresPassword = Array.from({length: 32}, () =>
Math.floor(Math.random() * 16).toString(16)).join('');
const domains: DomainSchema[] = [
{
host: mainDomain,
port: 80,
serviceName: "activepieces",
},
];
const envs = [
`AP_HOST=${mainDomain}`,
`AP_API_KEY=${apiKey}`,
`AP_ENCRYPTION_KEY=${encryptionKey}`,
`AP_JWT_SECRET=${jwtSecret}`,
`AP_POSTGRES_PASSWORD=${postgresPassword}`,
];
return {
domains,
envs,
};
}