Skip to content

feat: make frontend config and theme file locations configurable #1830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

HayenNico
Copy link
Member

@HayenNico HayenNico commented Apr 8, 2025

Description

Add backend configuration options to customize the file locations of frontend.config.json and frontend.theme.json via new environment variables FRONTEND_CONFIG_FILE and FRONTEND_THEME_FILE. The default location has been changed from /src/config to project root for consistency with other customizable configuration files (up for discussion).

Motivation

The backend will serve a configuration and theme to a connected frontend via the /api/v3/admin/config and /api/v3/admin/theme endpoints. The data sources for these endpoints are currently hardcoded to /src/config/frontend.config.json and /src/config/frontend.config.json. This is inconsistent with other configuration files which are located at the project root and can be configured in .env.

This PR introduces environment variables FRONTEND_CONFIG_FILE and FRONTEND_THEME_FILE for customizing the location of the json files. The default location of both files has been moved to the project root directory.

Changes:

  • added FRONTEND_CONFIG_FILE and FRONTEND_THEME_FILE environment variables
  • admin.service gets config and theme from ConfigService instead of static location
  • moved frontend.config.json and frontend.theme.json from /src/config to project root directory
  • null returns from admin controller/service now indicate missing frontend configuration or theme
  • admin.servoce.spec unit tests use mock objects instead of static json

Tests included

  • Included for each change/fix?
  • Passing?

Documentation

  • swagger documentation updated (required for API changes)
  • official documentation updated

official documentation info

@HayenNico HayenNico added enhancement New feature or request DCS DAPHNE Contribution to SciCat Discussion needed labels Apr 8, 2025
@HayenNico HayenNico self-assigned this Apr 8, 2025
@HayenNico
Copy link
Member Author

HayenNico commented Apr 8, 2025

Will leave conflicts between master and this branch alone until some points are discussed. I'll transfer the most recent frontend.config.json to the new file once ready to merge.

  • Is the change in default location for config and theme sensible?
  • Do downstream dependencies (SciCatLive, local installations) benefit from this or is this a hindrance?

@nitrosx
Copy link
Member

nitrosx commented Apr 15, 2025

@HayenNico I think that the changes is sensible, although I would move all the configuration files under a folder called config, so we do not struggle to find them in between all the other files.

It definitely impact existing deployment, unless they specify the relative env variables to the current location that they are using now. Maybe we should explicitly say that in the documentation.

@HayenNico
Copy link
Member Author

@nitrosx Okay, in that case how about this plan:
For this PR I'll revert the default location for FE config back to the original spot, so things will continue to work for any deployment with the added new .env options in case someone wants to move the files.
For reorganizing all different configuration files in one place, I'll open a new PR. Do you think it would make sense to add functionality for multiple fallback cases for where to find a file? For eample: If the location in .env does not work, should the config service then look in a few standard places (config folder, project root) if it can find something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DCS DAPHNE Contribution to SciCat Discussion needed enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants