diff --git a/lib/constants.js b/lib/constants.js index c75dbfaa..4136f1e9 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -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;