@@ -45,19 +45,16 @@ export const SITECORE_EDGE_URL_PUBLIC_ENV = 'NEXT_PUBLIC_SITECORE_EDGE_URL';
4545 * @public
4646 *
4747 * @example
48- * // With SITECORE_EDGE_HOSTNAME=my-tenant.edge.example.com
4948 * resolveEdgeUrl() // => 'https://my-tenant.edge.example.com'
5049 *
5150 * @example
52- * // With explicit edgeUrl parameter
5351 * resolveEdgeUrl('https://custom.edge.com') // => 'https://custom.edge.com'
5452 *
5553 * @example
56- * // With no env vars set (fallback to default)
5754 * resolveEdgeUrl() // => 'https://edge-platform.sitecorecloud.io'
5855 */
5956export function resolveEdgeUrl ( edgeUrl ?: string ) : string {
60- // 1. Use explicit edgeUrl if provided and not empty
57+ // Use explicit edgeUrl if provided and not empty
6158 const explicit = normalizeMaybeEnvValue ( edgeUrl ) ;
6259 if ( explicit ) {
6360 return normalizeUrl ( explicit ) ;
@@ -66,7 +63,7 @@ export function resolveEdgeUrl(edgeUrl?: string): string {
6663 // Determine if we're in browser context
6764 const isBrowser = typeof window !== 'undefined' ;
6865
69- // 2. Check for custom hostname env var (prioritize custom hostname over URL)
66+ // Check for custom hostname env var (prioritize custom hostname over URL)
7067 const hostnameEnvVarRaw = isBrowser
7168 ? process . env [ SITECORE_EDGE_HOSTNAME_PUBLIC_ENV ]
7269 : process . env [ SITECORE_EDGE_HOSTNAME_ENV ] || process . env [ SITECORE_EDGE_HOSTNAME_PUBLIC_ENV ] ;
@@ -76,7 +73,7 @@ export function resolveEdgeUrl(edgeUrl?: string): string {
7673 return normalizeHostnameToUrl ( hostnameEnvVar ) ;
7774 }
7875
79- // 3. Check for Edge URL env var
76+ // Check for Edge URL env var
8077 const urlEnvVarRaw = isBrowser
8178 ? process . env [ SITECORE_EDGE_URL_PUBLIC_ENV ]
8279 : process . env [ SITECORE_EDGE_URL_ENV ] || process . env [ SITECORE_EDGE_URL_PUBLIC_ENV ] ;
@@ -86,7 +83,7 @@ export function resolveEdgeUrl(edgeUrl?: string): string {
8683 return normalizeUrl ( urlEnvVar ) ;
8784 }
8885
89- // 4. Fall back to default
86+ // Fall back to default
9087 return SITECORE_EDGE_URL_DEFAULT ;
9188}
9289
0 commit comments