mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 09:57:00 +01:00
Update database detection.
This commit is contained in:
parent
07cc61f5c3
commit
7a81dda7b6
@ -95,7 +95,6 @@ export function getDateArray(data, startDate, endDate, unit) {
|
||||
const arr = [];
|
||||
const [diff, add, normalize] = dateFuncs[unit];
|
||||
const n = diff(endDate, startDate) + 1;
|
||||
console.log({ startDate, endDate, n });
|
||||
|
||||
function findData(t) {
|
||||
const x = data.find(e => {
|
||||
|
@ -22,7 +22,10 @@ const POSTGRESQL_DATE_FORMATS = {
|
||||
};
|
||||
|
||||
export function getDatabase() {
|
||||
return process.env.DATABASE_TYPE || process.env.DATABASE_URL.split(':')[0];
|
||||
return (
|
||||
process.env.DATABASE_TYPE ||
|
||||
(process.env.DATABASE_URL && process.env.DATABASE_URL.split(':')[0])
|
||||
);
|
||||
}
|
||||
|
||||
export function getDateQuery(db, field, unit, timezone) {
|
||||
|
@ -2,7 +2,8 @@ require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const databaseType = process.env.DATABASE_TYPE || process.env.DATABASE_URL.split(':')[0];
|
||||
const databaseType =
|
||||
process.env.DATABASE_TYPE || (process.env.DATABASE_URL && process.env.DATABASE_URL.split(':')[0]);
|
||||
|
||||
if (!databaseType) {
|
||||
throw new Error('Database schema not specified');
|
||||
|
Loading…
Reference in New Issue
Block a user