clean-up protocol, update getDatabaseType logic for CH
This commit is contained in:
@@ -25,16 +25,13 @@ function getClient() {
|
||||
hostname,
|
||||
port,
|
||||
pathname,
|
||||
// protocol,
|
||||
protocol,
|
||||
username = 'default',
|
||||
password,
|
||||
} = new URL(process.env.CLICKHOUSE_URL);
|
||||
|
||||
// const formattedProtocol =
|
||||
// protocol.toLowerCase() === 'clickhouse:' || protocol === 'https:' ? 'https:' : 'http:';
|
||||
|
||||
const client = createClient({
|
||||
host: `http://${hostname}:${port}`,
|
||||
host: `${protocol}//${hostname}:${port}`,
|
||||
database: pathname.replace('/', ''),
|
||||
username: username,
|
||||
password,
|
||||
|
||||
@@ -17,6 +17,10 @@ export function getDatabaseType(url = process.env.DATABASE_URL) {
|
||||
return POSTGRESQL;
|
||||
}
|
||||
|
||||
if (process.env.CLICKHOUSE_URL) {
|
||||
return CLICKHOUSE;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user