feat(root): added migrations and optimized profile table
This commit is contained in:
committed by
Carl-Gerhard Lindesvärd
parent
2258fed24a
commit
b44f1958a2
@@ -112,12 +112,7 @@ function removeServiceFromDockerCompose(serviceName: string) {
|
||||
}
|
||||
|
||||
function writeEnvFile(envs: {
|
||||
POSTGRES_PASSWORD: string | undefined;
|
||||
REDIS_PASSWORD: string | undefined;
|
||||
CLICKHOUSE_URL: string;
|
||||
CLICKHOUSE_DB: string;
|
||||
CLICKHOUSE_USER: string;
|
||||
CLICKHOUSE_PASSWORD: string;
|
||||
REDIS_URL: string;
|
||||
DATABASE_URL: string;
|
||||
DOMAIN_NAME: string;
|
||||
@@ -131,9 +126,6 @@ function writeEnvFile(envs: {
|
||||
|
||||
let newEnvFile = envTemplate
|
||||
.replace('$CLICKHOUSE_URL', envs.CLICKHOUSE_URL)
|
||||
.replace('$CLICKHOUSE_DB', envs.CLICKHOUSE_DB)
|
||||
.replace('$CLICKHOUSE_USER', envs.CLICKHOUSE_USER)
|
||||
.replace('$CLICKHOUSE_PASSWORD', envs.CLICKHOUSE_PASSWORD)
|
||||
.replace('$REDIS_URL', envs.REDIS_URL)
|
||||
.replace('$DATABASE_URL', envs.DATABASE_URL)
|
||||
.replace('$DATABASE_URL_DIRECT', envs.DATABASE_URL)
|
||||
@@ -149,10 +141,6 @@ function writeEnvFile(envs: {
|
||||
.replace('$CLERK_SECRET_KEY', envs.CLERK_SECRET_KEY)
|
||||
.replace('$CLERK_SIGNING_SECRET', envs.CLERK_SIGNING_SECRET);
|
||||
|
||||
if (envs.POSTGRES_PASSWORD) {
|
||||
newEnvFile += `\nPOSTGRES_PASSWORD=${envs.POSTGRES_PASSWORD}`;
|
||||
}
|
||||
|
||||
fs.writeFileSync(
|
||||
envPath,
|
||||
newEnvFile
|
||||
@@ -234,26 +222,9 @@ async function initiateOnboarding() {
|
||||
{
|
||||
type: 'input',
|
||||
name: 'CLICKHOUSE_URL',
|
||||
message: 'Enter your ClickHouse URL:',
|
||||
default: process.env.DEBUG ? 'http://clickhouse:8123' : undefined,
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'CLICKHOUSE_DB',
|
||||
message: 'Enter your ClickHouse DB name:',
|
||||
default: process.env.DEBUG ? 'db_openpanel' : undefined,
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'CLICKHOUSE_USER',
|
||||
message: 'Enter your ClickHouse user name:',
|
||||
default: process.env.DEBUG ? 'user_openpanel' : undefined,
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'CLICKHOUSE_PASSWORD',
|
||||
message: 'Enter your ClickHouse password:',
|
||||
default: process.env.DEBUG ? 'ch_password' : undefined,
|
||||
message:
|
||||
'Enter your ClickHouse URL (format: http://user:pw@host:port/db):',
|
||||
default: process.env.DEBUG ? 'http://op-ch:8123/openpanel' : undefined,
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -268,8 +239,8 @@ async function initiateOnboarding() {
|
||||
{
|
||||
type: 'input',
|
||||
name: 'REDIS_URL',
|
||||
message: 'Enter your Redis URL:',
|
||||
default: process.env.DEBUG ? 'redis://redis:6379' : undefined,
|
||||
message: 'Enter your Redis URL (format: redis://user:pw@host:port/db):',
|
||||
default: process.env.DEBUG ? 'redis://op-kv:6379' : undefined,
|
||||
},
|
||||
]);
|
||||
envs = {
|
||||
@@ -283,9 +254,10 @@ async function initiateOnboarding() {
|
||||
{
|
||||
type: 'input',
|
||||
name: 'DATABASE_URL',
|
||||
message: 'Enter your Database URL:',
|
||||
message:
|
||||
'Enter your Database URL (format: postgresql://user:pw@host:port/db):',
|
||||
default: process.env.DEBUG
|
||||
? 'postgresql://postgres:postgres@postgres:5432/postgres?schema=public'
|
||||
? 'postgresql://postgres:postgres@op-db:5432/postgres?schema=public'
|
||||
: undefined,
|
||||
},
|
||||
]);
|
||||
@@ -399,20 +371,13 @@ async function initiateOnboarding() {
|
||||
|
||||
console.log('');
|
||||
console.log('Creating .env file...\n');
|
||||
const POSTGRES_PASSWORD = generatePassword(20);
|
||||
const REDIS_PASSWORD = generatePassword(20);
|
||||
|
||||
writeEnvFile({
|
||||
POSTGRES_PASSWORD: envs.DATABASE_URL ? undefined : POSTGRES_PASSWORD,
|
||||
REDIS_PASSWORD: envs.REDIS_URL ? undefined : REDIS_PASSWORD,
|
||||
CLICKHOUSE_URL: envs.CLICKHOUSE_URL || 'http://op-ch:8123',
|
||||
CLICKHOUSE_DB: envs.CLICKHOUSE_DB || 'openpanel',
|
||||
CLICKHOUSE_USER: envs.CLICKHOUSE_USER || 'openpanel',
|
||||
CLICKHOUSE_PASSWORD: envs.CLICKHOUSE_PASSWORD || generatePassword(20),
|
||||
CLICKHOUSE_URL: envs.CLICKHOUSE_URL || 'http://op-ch:8123/openpanel',
|
||||
REDIS_URL: envs.REDIS_URL || 'redis://op-kv:6379',
|
||||
DATABASE_URL:
|
||||
envs.DATABASE_URL ||
|
||||
`postgresql://postgres:${POSTGRES_PASSWORD}@op-db:5432/postgres?schema=public`,
|
||||
`postgresql://postgres:postgres@op-db:5432/postgres?schema=public`,
|
||||
DOMAIN_NAME: domainNameResponse.domainName,
|
||||
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY:
|
||||
clerkResponse.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY || '',
|
||||
|
||||
Reference in New Issue
Block a user