Page History
...
First, you will need to make minor modifications to the old "environment.*.ts" configuration file(s) to ensure it no longer imports any other files:
Code Block title Replace all imports in environment.*.ts // (1) FIRST, you must comment out or remove all 4 imports at the top of the file. For example: //import { GlobalConfig } from '../config/global-config.interface'; //import { NotificationAnimationsType } from '../app/shared/notifications/models/notification-animations-type'; //import { BrowseByType } from '../app/browse-by/browse-by-switcher/browse-by-decorator'; //import { RestRequestMethod } from '../app/core/data/rest-request-method'; // (2) SECOND, replace those 4 imported objects with these 4 objects. // Paste this code at the top of the file where those imports were. interface GlobalConfig { } enum NotificationAnimationsType { Fade = 'fade', FromTop = 'fromTop', FromRight = 'fromRight', FromBottom = 'fromBottom', FromLeft = 'fromLeft', Rotate = 'rotate', Scale = 'scale' } enum BrowseByType { Title = 'title', Metadata = 'metadata', Date = 'date' } enum RestRequestMethod { GET = 'GET', POST = 'POST', PUT = 'PUT', DELETE = 'DELETE', OPTIONS = 'OPTIONS', HEAD = 'HEAD', PATCH = 'PATCH' }
Now, you are ready to run the "yarn env:yaml" command to transform this old configuration into the new format.
Code Block title Migrate from environment.\*.ts to config.\*.yml yarn env:yaml [relative-path-to-environment.ts] [optional-relative-path-to-YAML] # For example, from the 7.2 (or above) root directory, run this: # yarn env:yaml relative/path/to/old/environment.prod.ts config/config.prod.yml
- Finally, you should replace the old environment.*.ts config file(s) can be deleted. They are not used at all in 7.2 or abovewith the stock versions. They continue to provide default configuration values, but customization should be done in the YAML files. If you had created additional environment files, those can be deleted.
Configuration Override
In 7.2 or above
...
The "rateLimiter" sub-section can be used to protect against a DOS (denial of service) attack when the UI is processed on the server side (i.e. server-side rendering). Default settings are usually OK. In Angular, server-side rendering occurs to support better Search Engine Optimization (SEO), as well as to support clients which cannot use Javascript. See also Angular's docs on Server-side renderingto support clients which cannot use Javascript. See also Angular's docs on Server-side rendering.
Sub-path in frontend URL: When using a subpath (nameSpace) in your UI server base URL (e.g. "http://localhost:4000/mysite/" instead of "http://localhost:4000/"), you must make sure that the URL without the subpath is added to the rest.cors.allowed-origins
list in [dspace]/config/modules/rest.cfg
or the local.cfg
override. The default value used for this configuration assumes that Origin and DSpace URL are identical, but CORS origins do not contain a subpath. Without this change you will see CORS policy errors preventing communication between the frontend and backend servers.
REST API Settings
The "rest" (REST API) section defines which REST API the UI will use. The REST settings MUST correspond to the primary URL of the backend. Usually, this means they must be kept in sync
with the value of dspace.server.url
in the backend's local.cfg
...
Code Block | ||||
---|---|---|---|---|
| ||||
auth: # Authentication UI settings ui: # the amount of time before the idle warning is shown timeUntilIdle: 900000 # 15 minutes # the amount of time the user has to react after the idle warning is shown before they are logged out. idleGracePeriod: 300000 # 5 minutes # Authentication REST # Authentication REST settings rest: # If the restsettings rest: # If the rest token expires in less than this amount of time, it will be refreshed automatically. # This is independent from the idle warning. Defaults to automatic refresh when the token will # expire within 2 minutes. Because token expires inafter less30 thanminutes this amount of timeby default, itthis will be refreshed automatically.means automatic # Thisrefresh iswould independentoccur fromevery the~28 idle warningminutes. timeLeftBeforeTokenRefresh: 120000 # 2 minutes |
...
Keep in mind, the "filter" MUST be a valid search filter (e.g. subject, author) as seen on the "/api/discover/facets" REST API endpoint. The "vocabulary" MUST be a valid controlled vocabulary installed in your DSpace backend (under "[dspace]/config/controlled-vocab/" folder based on the documentation at Authority Control of Metadata Values.
When this feature is enabled, you should see a "Browse [filter] tree" link in the search filter on the search results page (and anywhere search filters are shown). This "Browse [filter] tree" link will allow you to select a search filter from within the configured hierarchical vocabulary.
Universal (Server-side Rendering) Settings
...
Code Block | ||
---|---|---|
| ||
// NOTE: will log all redux actions and transfers in console debug: false |