mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-11 07:32:57 +03:00
[PR #815] [MERGED] refactor: use reflection to mark file based env variables #615
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/pocket-id/pocket-id/pull/815
Author: @stonith404
Created: 8/7/2025
Status: ✅ Merged
Merged: 8/7/2025
Merged by: @stonith404
Base:
main← Head:refactor/file-based-env-variables📝 Commits (6)
38b7e36refactor: use reflection to mark file based env variables222f7aefix linter issuesd1ccf92fix unit test61db90chandle files containing binary for encryption key correctlyb914906trim whitespaces for non binary filesbfcb510fix unit test📊 Changes
3 files changed (+210 additions, -82 deletions)
View changed files
📝
backend/internal/cmds/key_rotate_test.go(+1 -1)📝
backend/internal/common/env_config.go(+91 -80)📝
backend/internal/common/env_config_test.go(+118 -1)📄 Description
These changes make it simpler to set up environment variables that can be read from a file. This also helps avoid mistakes, like when a developer might accidentally try to access
MaxMindLicenseKeyFileinstead ofMaxMindLicenseKeyin the code.Now, you can use
options:"file"to mark environment variables. When marked this way, Pocket ID will try to read fromANY_ENV_VARIABLE_FILEinstead ofANY_ENV_VARIABLE. If the file version isn't defined, it will useANY_ENV_VARIABLEas a fallback.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.