SciCatProject / SciCatProject/backend
Use config object in Dataset controller
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 37
- Avg merge
- 17h 32m
- Merged PRs (30d)
- 38
Description
Summary
Currently in datasets controller, we retrieve the values for the following variable directly from process.env:
- CREATE_DATASET_WITH_PID_GROUPS
- DATASET_CREATION_VALIDATION_ENABLED
- DATASET_CREATION_VALIDATION_REGEX
- ADMIN_GROUPS
For consistency sake, we should use the config object, which use the env variables, but also allows a facility to further customize the configuration directly in code if env variables are not enough for their use case.
Expected Behaviour
datasets.controller import config object and use equivalent values in there.
Config object pulls in the equivalent env variable value if they are configured, or use the default one hardcoded.
Extra Details
Changes in Dataset.controller should be done at the following location:
- https://github.com/SciCatProject/scicat-backend-next/blob/a9ac0adaec026204dae501366106d23ed288163d/src/datasets/datasets.controller.ts#L213
- https://github.com/SciCatProject/scicat-backend-next/blob/a9ac0adaec026204dae501366106d23ed288163d/src/datasets/datasets.controller.ts#L219
- https://github.com/SciCatProject/scicat-backend-next/blob/a9ac0adaec026204dae501366106d23ed288163d/src/datasets/datasets.controller.ts#L219
- https://github.com/SciCatProject/scicat-backend-next/blob/a9ac0adaec026204dae501366106d23ed288163d/src/datasets/datasets.controller.ts#L283
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/datasets/datasets.controller.ts at the referenced lines and inspect the existing config object for equivalents of the four process.env variables: CREATE_DATASET_WITH_PID_GROUPS, DATASET_CREATION_VALIDATION_ENABLED, DATASET_CREATION_VALIDATION_REGEX, and ADMIN_GROUPS. Update the controller to use those config values, preserving configured environment values and defaults; done means no direct environment reads remain for these settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100