All files / src/utils internalHost.ts

100% Statements 3/3
100% Branches 2/2
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17                    1x     19x 19x    
/**
 * Internal ZMS citizenview hosts.
 *
 * Prod serves the same pages on zms.muenchen.de (internal) and
 * www48.muenchen.de (public). Magnolia embeds the web component on
 * stadt.muenchen.de. Same split as ACCESS_UNPUBLISHED_ON_DOMAIN=zms:
 * the internal host contains "zms", the public hosts do not.
 * Localhost and ddev count as internal.
 */
const INTERNAL_ZMS_HOST =
  /^(?:localhost|127\.0\.0\.1|\[::1\]|zms\.ddev\.site|zms(?:-[a-z0-9-]+)?\.muenchen\.de)$/;
 
export function isInternalZmsHost(hostname: string | undefined): boolean {
  const host = (hostname ?? "").trim().toLowerCase().replace(/\.$/, "");
  return INTERNAL_ZMS_HOST.test(host);
}