|
13 | 13 | /**
|
14 | 14 | * @type {Record<string, Record<string, Config>>}
|
15 | 15 | */
|
16 |
| -const TENANT_CONFIGS = { |
17 |
| - visualcomfort: { |
18 |
| - base: { |
19 |
| - apiKey: '59878b5d8af24fe9a354f523f5a0bb62', |
20 |
| - magentoEnvironmentId: '97034e45-43a5-48ab-91ab-c9b5a98623a8', |
21 |
| - magentoWebsiteCode: 'base', |
22 |
| - magentoStoreViewCode: 'default', |
23 |
| - coreEndpoint: 'https://www.visualcomfort.com/graphql', |
24 |
| - }, |
25 |
| - '/us/p/{{urlkey}}/{{sku}}': { |
26 |
| - pageType: 'product', |
27 |
| - apiKey: '59878b5d8af24fe9a354f523f5a0bb62', |
28 |
| - magentoEnvironmentId: '97034e45-43a5-48ab-91ab-c9b5a98623a8', |
29 |
| - magentoWebsiteCode: 'base', |
30 |
| - magentoStoreViewCode: 'default', |
31 |
| - coreEndpoint: 'https://www.visualcomfort.com/graphql', |
32 |
| - }, |
33 |
| - }, |
34 |
| -}; |
| 16 | +// const TENANT_CONFIGS = { |
| 17 | +// visualcomfort: { |
| 18 | +// base: { |
| 19 | +// apiKey: '59878b5d8af24fe9a354f523f5a0bb62', |
| 20 | +// magentoEnvironmentId: '97034e45-43a5-48ab-91ab-c9b5a98623a8', |
| 21 | +// magentoWebsiteCode: 'base', |
| 22 | +// magentoStoreViewCode: 'default', |
| 23 | +// coreEndpoint: 'https://www.visualcomfort.com/graphql', |
| 24 | +// }, |
| 25 | +// '/us/p/{{urlkey}}/{{sku}}': { |
| 26 | +// pageType: 'product', |
| 27 | +// apiKey: '59878b5d8af24fe9a354f523f5a0bb62', |
| 28 | +// magentoEnvironmentId: '97034e45-43a5-48ab-91ab-c9b5a98623a8', |
| 29 | +// magentoWebsiteCode: 'base', |
| 30 | +// magentoStoreViewCode: 'default', |
| 31 | +// coreEndpoint: 'https://www.visualcomfort.com/graphql', |
| 32 | +// }, |
| 33 | +// }, |
| 34 | +// }; |
35 | 35 |
|
36 | 36 | /**
|
37 | 37 | * @param {string[]} patterns
|
@@ -59,10 +59,12 @@ function extractPathParams(pattern, path) {
|
59 | 59 | * @param {Context} ctx
|
60 | 60 | * @param {string} tenant
|
61 | 61 | * @param {Partial<Config>} [overrides={}]
|
62 |
| - * @returns {Config|null} |
| 62 | + * @returns {Promise<Config|null>} |
63 | 63 | */
|
64 |
| -export function resolveConfig(ctx, tenant, overrides, configs = TENANT_CONFIGS) { |
65 |
| - const confMap = configs[tenant]; |
| 64 | +export async function resolveConfig(ctx, tenant, overrides = {}) { |
| 65 | + const confMap = await ctx.env.CONFIGS.get(tenant, 'json'); |
| 66 | + console.log('confMap: ', tenant, confMap, confMap); |
| 67 | + console.log('config list: ', await ctx.env.CONFIGS.list()); |
66 | 68 | if (!confMap) {
|
67 | 69 | return null;
|
68 | 70 | }
|
|
0 commit comments