mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 12:05:41 +01:00
Allow Umami to be configured with UMAMI_DATABASE_URL
This commit is contained in:
parent
bce70c1034
commit
acc3f10284
4 changed files with 10 additions and 7 deletions
|
|
@ -10,7 +10,7 @@ if (process.env.SKIP_DB_CHECK) {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatabaseType(url = process.env.DATABASE_URL) {
|
function getDatabaseType(url = process.env.UMAMI_DATABASE_URL || process.env.DATABASE_URL) {
|
||||||
const type = url && url.split(':')[0];
|
const type = url && url.split(':')[0];
|
||||||
|
|
||||||
if (type === 'postgres') {
|
if (type === 'postgres') {
|
||||||
|
|
@ -31,10 +31,10 @@ function error(msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkEnv() {
|
async function checkEnv() {
|
||||||
if (!process.env.DATABASE_URL) {
|
if (!process.env.UMAMI_DATABASE_URL && !process.env.DATABASE_URL) {
|
||||||
throw new Error('DATABASE_URL is not defined.');
|
throw new Error('Neither UMAMI_DATABASE_URL nor DATABASE_URL is defined.');
|
||||||
} else {
|
} else {
|
||||||
success('DATABASE_URL is defined.');
|
success('Database URL is defined.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,10 @@ function checkMissing(vars) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!process.env.SKIP_DB_CHECK && !process.env.DATABASE_TYPE) {
|
if (!process.env.SKIP_DB_CHECK && !process.env.DATABASE_TYPE) {
|
||||||
checkMissing(['DATABASE_URL']);
|
if (!process.env.UMAMI_DATABASE_URL && !process.env.DATABASE_URL) {
|
||||||
|
console.log('Neither UMAMI_DATABASE_URL nor DATABASE_URL is defined.');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.CLOUD_MODE) {
|
if (process.env.CLOUD_MODE) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ const fse = require('fs-extra');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const del = require('del');
|
const del = require('del');
|
||||||
|
|
||||||
function getDatabaseType(url = process.env.DATABASE_URL) {
|
function getDatabaseType(url = process.env.UMAMI_DATABASE_URL || process.env.DATABASE_URL) {
|
||||||
const type = process.env.DATABASE_TYPE || (url && url.split(':')[0]);
|
const type = process.env.DATABASE_TYPE || (url && url.split(':')[0]);
|
||||||
|
|
||||||
if (type === 'postgres') {
|
if (type === 'postgres') {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ BigInt.prototype['toJSON'] = function () {
|
||||||
return Number(this);
|
return Number(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getDatabaseType(url = process.env.DATABASE_URL) {
|
export function getDatabaseType(url = process.env.UMAMI_DATABASE_URL || process.env.DATABASE_URL) {
|
||||||
const type = url && url.split(':')[0];
|
const type = url && url.split(':')[0];
|
||||||
|
|
||||||
if (type === 'postgres') {
|
if (type === 'postgres') {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue