Skip to content

Commit 21ac024

Browse files
[DURACOM-344] adapt patterns and example file, fix possible error from YAML
1 parent ce0f615 commit 21ac024

6 files changed

Lines changed: 39 additions & 20 deletions

File tree

config/config.example.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,21 @@ universal:
2323
# Determining which styles are critical is a relatively expensive operation; this option is
2424
# disabled (false) by default to boost server performance at the expense of loading smoothness.
2525
inlineCriticalCss: false
26-
# Regexes to be run against the path of the page to check if SSR is allowed.
26+
# Patterns to be run as regexes against the path of the page to check if SSR is allowed.
2727
# If the path match any of the regexes it will be served directly in CSR.
2828
# By default, excludes community and collection browse, global browse, global search, community list, and statistics.
29-
excludePathRegexes: [
30-
/^\/communities\/[ 0-9a-f ]{ 8 }-[ 0-9a-f ]{ 4 }-[ 0-9a-f ]{ 4 }-[ 0-9a-f ]{ 4 }-[ 0-9a-f ]{ 12 }\/browse(\/.*)?$/i,
31-
/^\/collections\/[ 0-9a-f ]{ 8 }-[ 0-9a-f ]{ 4 }-[ 0-9a-f ]{ 4 }-[ 0-9a-f ]{ 4 }-[ 0-9a-f ]{ 12 }\/browse(\/.*)?$/i,
32-
/^\/browse\//,
33-
/^\/search$/,
34-
/^\/community-list$/,
35-
/^\/statistics$/,
36-
]
29+
excludePathPatterns:
30+
- /^\/communities\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/browse(\/.*)?$/i
31+
- /^\/collections\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/browse(\/.*)?$/i
32+
- /^\/browse\//
33+
- /^\/search$/
34+
- /^\/community-list$/
35+
- /^\/statistics\//
36+
- /^\/admin$/
37+
- /^\/processes$/
38+
- /^\/notifications$/
39+
- /^\/health$/
40+
3741
# Whether to enable rendering of Search component on SSR.
3842
# If set to true the component will be included in the HTML returned from the server side rendering.
3943
# If set to false the component will not be included in the HTML returned from the server side rendering.

server.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,13 @@ function start() {
629629
* Check if SSR should be skipped for path
630630
*
631631
* @param path
632-
* @param excludePathRegexes
632+
* @param excludePathPattern
633633
*/
634-
function isExcludedFromSsr(path: string, excludePathRegexes: RegExp[]): boolean {
635-
return excludePathRegexes.some((regex) => regex.test(path));
634+
function isExcludedFromSsr(path: string, excludePathPattern: (string | RegExp)[]): boolean {
635+
return excludePathPattern.some((pattern) => {
636+
const regex = new RegExp(pattern);
637+
return regex.test(path)
638+
});
636639
}
637640

638641
/*

src/config/universal-config.interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export interface UniversalConfig extends Config {
3232
replaceRestUrl: boolean;
3333

3434
/**
35-
* Regexes to match url's path and check if SSR is disabled for it.
35+
* Patterns to be used as regexes to match url's path and check if SSR is disabled for it.
3636
*/
37-
excludePathRegexes: RegExp[];
37+
excludePathPatterns: (string | RegExp)[];
3838

3939
/**
4040
* Whether to enable rendering of search component on SSR

src/environments/environment.production.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ export const environment: Partial<BuildConfig> = {
1111
inlineCriticalCss: false,
1212
transferState: true,
1313
replaceRestUrl: true,
14-
excludePathRegexes: [
14+
excludePathPatterns: [
1515
/^\/communities\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/browse(\/.*)?$/i,
1616
/^\/collections\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/browse(\/.*)?$/i,
1717
/^\/browse\//,
1818
/^\/search$/,
1919
/^\/community-list$/,
20-
/^\/statistics$/,
20+
/^\/statistics\//,
21+
/^\/admin$/,
22+
/^\/processes$/,
23+
/^\/notifications$/,
24+
/^\/health$/,
2125
],
2226
enableSearchComponent: false,
2327
enableBrowseComponent: false,

src/environments/environment.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ export const environment: BuildConfig = {
1414
inlineCriticalCss: false,
1515
transferState: true,
1616
replaceRestUrl: false,
17-
excludePathRegexes: [
17+
excludePathPatterns: [
1818
/^\/communities\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/browse(\/.*)?$/i,
1919
/^\/collections\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/browse(\/.*)?$/i,
2020
/^\/browse\//,
2121
/^\/search$/,
2222
/^\/community-list$/,
23-
/^\/statistics$/,
23+
/^\/statistics\//,
24+
/^\/admin$/,
25+
/^\/processes$/,
26+
/^\/notifications$/,
27+
/^\/health$/,
2428
],
2529
enableSearchComponent: false,
2630
enableBrowseComponent: false,

src/environments/environment.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ export const environment: Partial<BuildConfig> = {
1616
inlineCriticalCss: false,
1717
transferState: true,
1818
replaceRestUrl: false,
19-
excludePathRegexes: [
19+
excludePathPatterns: [
2020
/^\/communities\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/browse(\/.*)?$/i,
2121
/^\/collections\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/browse(\/.*)?$/i,
2222
/^\/browse\//,
2323
/^\/search$/,
2424
/^\/community-list$/,
25-
/^\/statistics$/,
25+
/^\/statistics\//,
26+
/^\/admin$/,
27+
/^\/processes$/,
28+
/^\/notifications$/,
29+
/^\/health$/,
2630
],
2731
enableSearchComponent: false,
2832
enableBrowseComponent: false,

0 commit comments

Comments
 (0)