Skip to content

Commit

Permalink
clean-up protocol, update getDatabaseType logic for CH
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscao633 committed Sep 29, 2023
1 parent 98b7624 commit c6d0fde
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/components/pages/reports/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export const ReportContext = createContext(null);
export function Report({ reportId, defaultParameters, children, ...props }) {
const report = useReport(reportId, defaultParameters);

//console.log({ report });

return (
<ReportContext.Provider value={{ ...report }}>
<Page {...props} className={styles.container}>
Expand Down
7 changes: 2 additions & 5 deletions src/lib/clickhouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions src/lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export function getDatabaseType(url = process.env.DATABASE_URL) {
return POSTGRESQL;
}

if (process.env.CLICKHOUSE_URL) {
return CLICKHOUSE;
}

return type;
}

Expand Down

0 comments on commit c6d0fde

Please sign in to comment.