Skip to content

Commit 76fb579

Browse files
authored
fix: allow siteID and token to be passed in Functions v2 and Edge Functions
1 parent b365fe9 commit 76fb579

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/store_factory.ts

+17
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,23 @@ export const getStore: {
7070

7171
if (typeof input?.name === 'string') {
7272
const { name } = input
73+
74+
if (typeof input?.siteID === 'string' && typeof input.token === 'string') {
75+
const { siteID, token } = input
76+
const clientOptions = getClientOptions(input, {
77+
siteID,
78+
token
79+
})
80+
81+
if (!siteID || !token) {
82+
throw new MissingBlobsEnvironmentError(['siteID', 'token'])
83+
}
84+
85+
const client = new Client(clientOptions)
86+
87+
return new Store({ client, name })
88+
}
89+
7390
const clientOptions = getClientOptions(input)
7491

7592
if (!name) {

0 commit comments

Comments
 (0)