* chore: Centralize env parsing, defaults, deprecation * wip * test * test * tsc * docs, more validation * fix: Allow empty REDIS_URL (defaults to localhost) * test * fix: SLACK_MESSAGE_ACTIONS not bool * fix: Add SMTP port validation
16 lines
449 B
TypeScript
16 lines
449 B
TypeScript
import { parseDomain, stripSubdomain } from "@shared/utils/domains";
|
|
import env from "@server/env";
|
|
|
|
export function getCookieDomain(domain: string) {
|
|
return env.SUBDOMAINS_ENABLED ? stripSubdomain(domain) : domain;
|
|
}
|
|
|
|
export function isCustomDomain(hostname: string) {
|
|
const parsed = parseDomain(hostname);
|
|
const main = parseDomain(env.URL);
|
|
|
|
return (
|
|
parsed && main && (main.domain !== parsed.domain || main.tld !== parsed.tld)
|
|
);
|
|
}
|