Skip to content

Commit

Permalink
feat: exclusive ICM URL for SSR process (#1624)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhyi authored Apr 12, 2024
1 parent ec03d56 commit a324675
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
1 change: 1 addition & 0 deletions docs/guides/ssr-startup.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Make sure to use them as written in the table below.
| | CONCURRENCY_SSR | number \| max | Concurrency for SSR instances per theme (default: 2) |
| | CACHE_ICM_CALLS | recommended \| JSON | Enable caching for ICM calls, see [Local ICM Cache](#local-icm-cache) (default: disabled) |
| **General** | ICM_BASE_URL | string | Sets the base URL for the ICM |
| | ICM_BASE_URL_SSR | string | Sets the base URL for the ICM used in SSR (optional) |
| | ICM_CHANNEL | string | Overrides the default channel |
| | ICM_APPLICATION | string | Overrides the default application |
| | FEATURES | comma-separated list | Overrides active features |
Expand Down
10 changes: 0 additions & 10 deletions scripts/icm-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ if (localICMCacheActive) {
content += ` ICM_BASE_URL_SSR: http://localhost:10000
`;
}
-----
*
* Code snippet to adapt 'src\app\core\store\core\configuration\configuration.selectors.ts':
-----
const ssrBaseUrl = typeof process !== 'undefined' && process.env.ICM_BASE_URL_SSR;
export const getICMServerURL = createSelector(getConfigurationState, state =>
state.baseURL && state.server ? `${ssrBaseUrl || state.baseURL}/${state.server}` : undefined
);
-----
*
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ export const getResponsiveStarterStoreApplication = createSelector(
state => state.hybridApplication || '-'
);

const ssrBaseUrl = SSR && process.env.ICM_BASE_URL_SSR;

export const getICMServerURL = createSelector(getConfigurationState, state =>
state.baseURL && state.server ? `${state.baseURL}/${state.server}` : undefined
state.baseURL && state.server ? `${ssrBaseUrl || state.baseURL}/${state.server}` : undefined
);

export const getRestEndpoint = createSelector(
Expand Down

0 comments on commit a324675

Please sign in to comment.