Convert configs to classes instead of interfaces#5114
Convert configs to classes instead of interfaces#5114strawburster wants to merge 2 commits intoDSpace:mainfrom
Conversation
965aa15 to
942f32b
Compare
eac17b3 to
a5482b2
Compare
a5482b2 to
a3a4582
Compare
|
Hi @strawburster, |
a3a4582 to
eac2bd0
Compare
eac2bd0 to
fe53925
Compare
|
The server failed to start, and I need the e2e results to move forward. Please re run this either once the server image is fixed or if you believe it was a fluke. |
fe53925 to
eb9f509
Compare
|
Hi @strawburster, |
eb9f509 to
3638fe5
Compare
3638fe5 to
3a1a826
Compare
Within class definitions, decorators defined in src/config/config.ts can set environment variables, whether or not a property should be publicly available, and what the type of a property is. The class definitions also allow default values to be set for each property. Removes BuildConfig, DefaultAppConfig, and ServerConfig in favor of using a single class, AppConfig, everywhere.
3a1a826 to
8a4d253
Compare
|
Many more |
References
Add references/links to any related issues or PRs. These may include:
config.json#5030Description
Refactor app configuration to use class instances instead of interfaces. The benefit is that decorators can be used to specify metadata about config properties.
The decorators supplied in this PR for config properties are
@Config.publish()@Config.env(name: string, loader?: (val: string) => any)and@Config.arrayOf(configClass)This will mark a config property as 'public', which is used in the 'toPublic' method to filter only properties which should be available publicly.
This will mark a config property as being able to be overridden by an environment variable with a specific name, and optionally a loader function which takes the string environment variable as its only parameter and returns the correct type for the property.
This will mark a property as being an array of a specific type of config, so that when merging the config with a plain object, array properties are instantiated correctly.
Instructions for Reviewers
Please add a more detailed description of the changes made by your PR. At a minimum, providing a bulleted list of changes in your PR is helpful to reviewers.
List of changes in this PR:
Include guidance for how to test or review your PR. This may include: steps to reproduce a bug, screenshots or description of a new feature, or reasons behind specific changes.
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)My PR aligns with Accessibility guidelines if it makes changes to the user interface.My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.If my PR includes new libraries/dependencies (inpackage.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.