MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / getHostFromHeaders

Function getHostFromHeaders

packages/utilities/src/domain.ts:16–35  ·  view source on GitHub ↗
(headers?: {
  host?: string;
  origin?: string;
})

Source from the content-addressed store, hash-verified

14}
15
16export function getHostFromHeaders(headers?: {
17 host?: string;
18 origin?: string;
19}) {
20 if (process.env.NODE_ENV === 'development') {
21 return `localhost:${process.env.PORT || 3000}`;
22 }
23 if (
24 headers?.origin?.startsWith('tauri://') ||
25 headers?.origin?.startsWith('linenapp://')
26 ) {
27 return process.env.NEXTAUTH_URL || 'www.linen.dev';
28 }
29 return (
30 headers?.origin ||
31 headers?.host ||
32 process.env.NEXTAUTH_URL ||
33 'www.linen.dev'
34 );
35}
36
37// Checks if the routing is subdomain or based on paths
38export const isSubdomainbasedRouting = (host: string): boolean => {

Callers 4

domain.test.tsFile · 0.90
createFunction · 0.90
handlerFunction · 0.90
inviteNewMembersFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected