All files / worker-play/src app-environment.ts

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

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    1x       5x    
import type { PlayEnvironment } from '@be-music/app-play/app-title';
 
const PREVIEW_PLAY_HOST = 'play.preview.be-music.app';
 
/** The deployment a Worker serves, from its public origin (`PUBLIC_ORIGIN`, cloudflare.config.ts). */
export function playEnvironmentOfOrigin(origin: string): Exclude<PlayEnvironment, 'development'> {
  return new URL(origin).hostname.toLowerCase() === PREVIEW_PLAY_HOST ? 'preview' : 'production';
}