custom constant prefix via env variable

pull/821/head
Dario Guarascio 2021-10-09 14:43:37 +02:00
parent e849d55b3f
commit a206654a04
1 changed files with 11 additions and 8 deletions

View File

@ -1,10 +1,12 @@
export const AUTH_COOKIE_NAME = 'umami.auth';
export const LOCALE_CONFIG = 'umami.locale';
export const TIMEZONE_CONFIG = 'umami.timezone';
export const DATE_RANGE_CONFIG = 'umami.date-range';
export const THEME_CONFIG = 'umami.theme';
export const VERSION_CHECK = 'umami.version-check';
export const TOKEN_HEADER = 'x-umami-token';
const prefix = process.env.UMAMI_CONST_PREFIX || 'umami';
export const AUTH_COOKIE_NAME = `${prefix}.auth`;
export const LOCALE_CONFIG = `${prefix}.locale`;
export const TIMEZONE_CONFIG = `${prefix}.timezone`;
export const DATE_RANGE_CONFIG = `${prefix}.date-range`;
export const THEME_CONFIG = `${prefix}.theme`;
export const VERSION_CHECK = `${prefix}.version-check`;
export const TOKEN_HEADER = 'x-${prefix}-token';
export const DEFAULT_LOCALE = 'en-US';
export const DEFAULT_THEME = 'light';
@ -80,7 +82,8 @@ export const POSTGRESQL_DATE_FORMATS = {
year: 'YYYY-01-01',
};
export const DOMAIN_REGEX = /^(localhost(:[1-9]\d{0,4})?|((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63})$/;
export const DOMAIN_REGEX =
/^(localhost(:[1-9]\d{0,4})?|((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63})$/;
export const DESKTOP_SCREEN_WIDTH = 1920;
export const LAPTOP_SCREEN_WIDTH = 1024;