Skip to content
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

Remove hard-coded configs in favour of env variables #848

Open
wants to merge 297 commits into
base: main
Choose a base branch
from

Conversation

maximilianoertel
Copy link
Collaborator

@maximilianoertel maximilianoertel commented Oct 4, 2024

Proposed changes

This PR removes hardcoded Firebase configuration values from the codebase and replaces them with environment variables. This change provides improved security by preventing accidental exposure of sensitive data and allows for easier configuration management across different deployment environments.

Additionally, this PR removes the .firebaserc configuration file, following Google's recommendation to exclude it from public repositories to prevent accidental exposure of sensitive information.

Key highlights

  • Hardcoded config values are replaced with environment variables using the dotenvx library for encrypted configurations.
  • Environment configurations are stored in a separate private repository and injected as a submodule in the env-configs directory.
  • Forks of the project can easily set their own configurations by using the traditional .env file format supported by Vite at the root of the project.
  • A .env.example file is provided at the root, serving as a source of truth for supported environment variables.
  • A pre-commit hook is included to ensure no unencrypted dotenv files are accidentally committed to the repository.

Given the changes in how environment configurations are handled, this PR also restructures the npm commands available on the repo. More specifically, it removes all dev and build command variants in favor of two simple npm run dev and npm run build commands. This is done to avoid accidentally running the command with the wrong environment configuration and better support forks and alternative environments such as ROAR Clinic or Levante.

Should you wish to execute a dev or production build with an alternative env configuration, it is recommended to use the --mode flag, for example npm run build -- --mode production which would use the .env.production config.

This approach promotes better separation of concerns, improves maintainability, and enhances the overall security posture of the application.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (non-breaking change that does not add functionality but makes code cleaner or more efficient)
  • Documentation Update
  • Tests (new or updated tests)
  • Style (changes to code styling)
  • CI (continuous integration changes)
  • Repository Maintenance
  • Other (please describe below)

Checklist

  • I have read the guidelines for contributing.
  • The changes in this PR are as small as they can be. They represent one and only one fix or enhancement.
  • Linting checks pass with my changes.
  • Any existing unit tests pass with my changes.
  • Any existing end-to-end tests pass with my changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • If this PR fixes an existing issue, I have added a unit or end-to-end test that will detect if this issue reoccurs.
  • I have added JSDoc comments as appropriate.
  • I have added the necessary documentation to the roar-docs repository.
  • I have shared this PR on the roar-pr-reviews channel (if I have access)
  • I have linked relevant issues (if any)

Justification of missing checklist items

n/a

Further comments

n/a

@maximilianoertel maximilianoertel marked this pull request as ready for review October 9, 2024 12:25
@maximilianoertel maximilianoertel requested a review from a team as a code owner October 9, 2024 12:25
@maximilianoertel maximilianoertel self-assigned this Oct 9, 2024
@maximilianoertel maximilianoertel added the enhancement New feature or request label Oct 9, 2024
@maximilianoertel maximilianoertel changed the base branch from main to ref/318/query-composables October 10, 2024 21:27
@maximilianoertel maximilianoertel changed the base branch from ref/318/query-composables to ref/318/query-composables-fetch-error October 10, 2024 21:33
@maximilianoertel maximilianoertel changed the base branch from ref/318/query-composables-fetch-error to ref/318/query-composables-update October 10, 2024 21:40
@maximilianoertel maximilianoertel changed the base branch from ref/318/query-composables-update to main October 10, 2024 21:41
@maximilianoertel maximilianoertel changed the base branch from main to ref/318/query-composables-update October 10, 2024 21:41
@maximilianoertel maximilianoertel changed the base branch from ref/318/query-composables-update to ref/318/query-composables-fetch-error October 10, 2024 22:01
Base automatically changed from ref/318/query-composables-fetch-error to ref/318/query-composables October 11, 2024 16:38
Base automatically changed from ref/318/query-composables to main October 15, 2024 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants