diff --git a/package.json b/package.json index 9a5e567..aa5175d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@crystallize/js-storefrontaware-utils", "license": "MIT", - "version": "0.2.0", + "version": "0.2.1", "author": "Crystallize (https://crystallize.com)", "contributors": [ "Sébastien Morel " diff --git a/src/adapters/filesystem.server.ts b/src/adapters/filesystem.server.ts index 7e95585..d0c63e3 100644 --- a/src/adapters/filesystem.server.ts +++ b/src/adapters/filesystem.server.ts @@ -5,7 +5,18 @@ export const createFilesystemAdapter = (filename: string): TStoreFrontAdapter => return { config: async (withSecrets: boolean): Promise => { const data = await fs.readFile(filename, { encoding: 'utf8' }); - return JSON.parse(data); + const unfilteredSecrets = JSON.parse(data); + if (withSecrets) { + return unfilteredSecrets; + } + return { + ...unfilteredSecrets, + configuration: { + ...unfilteredSecrets.configuration, + ACCESS_TOKEN_ID: '', + ACCESS_TOKEN_SECRET: '', + }, + }; }, }; }; diff --git a/src/adapters/memory.server.ts b/src/adapters/memory.server.ts index 514b9e6..8213b83 100644 --- a/src/adapters/memory.server.ts +++ b/src/adapters/memory.server.ts @@ -2,6 +2,18 @@ import { TStoreFrontAdapter, TStoreFrontConfig } from '../types'; export const createMemoryAdapter = (config: TStoreFrontConfig): TStoreFrontAdapter => { return { - config: async (withSecrets: boolean): Promise => config, + config: async (withSecrets: boolean): Promise => { + if (withSecrets) { + return config; + } + return { + ...config, + configuration: { + ...config.configuration, + ACCESS_TOKEN_ID: '', + ACCESS_TOKEN_SECRET: '', + }, + }; + }, }; };