11import { isSpin } from './spin.js'
22import { isTruthy } from './utilities.js'
33import { getCIMetadata , isSet , Metadata } from '../../../private/node/context/utilities.js'
4- import { environmentVariables , pathConstants } from '../../../private/node/constants.js'
4+ import { defaultThemeKitAccessDomain , environmentVariables , pathConstants } from '../../../private/node/constants.js'
55import { fileExists } from '../fs.js'
66import { exec } from '../system.js'
77import { getPartnersToken } from '../environment.js'
@@ -287,6 +287,22 @@ export function macAddress(): Promise<string> {
287287 return macaddress . one ( )
288288}
289289
290+ /**
291+ * Get the domain for theme kit access.
292+ *
293+ * It can be overridden via the SHOPIFY_CLI_THEME_KIT_ACCESS_DOMAIN environment
294+ * variable.
295+ *
296+ * @param env - The environment variables from the environment of the process.
297+ *
298+ * @returns The domain for theme kit access.
299+ */
300+ export function getThemeKitAccessDomain ( env = process . env ) : string {
301+ const domain = env [ environmentVariables . themeKitAccessDomain ]
302+
303+ return isSet ( domain ) ? domain : defaultThemeKitAccessDomain
304+ }
305+
290306/**
291307 * Get the domain to send OTEL metrics to.
292308 *
@@ -295,11 +311,10 @@ export function macAddress(): Promise<string> {
295311 * @param env - The environment variables from the environment of the current process.
296312 * @returns The domain to send OTEL metrics to.
297313 */
298- export function opentelemetryDomain ( env = process . env ) : string | undefined {
299- if ( isSet ( env [ environmentVariables . otelURL ] ) ) {
300- return env [ environmentVariables . otelURL ]
301- }
302- return 'https://otlp-http-production-cli.shopifysvc.com'
314+ export function opentelemetryDomain ( env = process . env ) : string {
315+ const domain = env [ environmentVariables . otelURL ]
316+
317+ return isSet ( domain ) ? domain : 'https://otlp-http-production-cli.shopifysvc.com'
303318}
304319
305320export type CIMetadata = Metadata
0 commit comments