-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): append channel to kv key to make it channel aware (#1075)
* feat(core): append channel to kv key to make it channel aware * fix: move namespace logic to kvKey * fix: version const
- Loading branch information
Showing
4 changed files
with
28 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@bigcommerce/catalyst-core": patch | ||
--- | ||
|
||
Append channel to kv keys. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
const VERSION = 'v3'; | ||
|
||
export const STORE_STATUS_KEY = 'storeStatus'; | ||
export const routeCacheKvKey = (pathname: string) => `v3_${pathname}`; | ||
|
||
export const kvKey = (key: string, channelId?: string) => { | ||
const namespace = process.env.KV_NAMESPACE ?? process.env.BIGCOMMERCE_STORE_HASH ?? 'store'; | ||
const id = channelId ?? process.env.BIGCOMMERCE_CHANNEL_ID ?? '1'; | ||
|
||
return `${namespace}_${id}_${VERSION}_${key}`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters