Skip to content

Commit 62ec878

Browse files
committed
add CANARY env var to add canary headers
1 parent eb6a028 commit 62ec878

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

packages/cli-kit/src/public/node/api/app-management.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {addCursorAndFiltersToAppLogsUrl} from './utilities.js'
33
import {appManagementFqdn} from '../context/fqdn.js'
44
import {setNextDeprecationDate} from '../../../private/node/context/deprecations-store.js'
55
import {buildHeaders} from '../../../private/node/api/headers.js'
6+
import {getEnvironmentVariables} from '../environment.js'
67
import {RequestModeInput} from '../http.js'
78
import Bottleneck from 'bottleneck'
89
import {TypedDocumentNode} from '@graphql-typed-document-node/core'
@@ -20,16 +21,32 @@ async function setupRequest(token: string) {
2021
const api = 'App Management'
2122
const fqdn = await appManagementFqdn()
2223
const url = `https://${fqdn}/app_management/unstable/graphql.json`
24+
25+
const addedHeaders: {[key: string]: string} = {}
26+
27+
// Add canary header if CANARY environment variable is set to '1'
28+
if (getEnvironmentVariables()['CANARY'] === '1') {
29+
addedHeaders['Shopify-Force-Canary'] = 'unstable'
30+
}
31+
2332
return {
2433
token,
2534
api,
2635
url,
36+
addedHeaders,
2737
responseOptions: {onResponse: handleDeprecations},
2838
}
2939
}
3040

3141
export const appManagementHeaders = (token: string): {[key: string]: string} => {
32-
return buildHeaders(token)
42+
const headers = buildHeaders(token)
43+
44+
// Add canary header if CANARY environment variable is set to '1'
45+
if (getEnvironmentVariables()['CANARY'] === '1') {
46+
headers['Shopify-Force-Canary'] = 'unstable'
47+
}
48+
49+
return headers
3350
}
3451

3552
export const appManagementAppLogsUrl = async (

0 commit comments

Comments
 (0)