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

chore(server): better typing for system config key #8580

Merged
merged 5 commits into from
Apr 7, 2024

Conversation

mertalev
Copy link
Contributor

@mertalev mertalev commented Apr 7, 2024

Description

The SystemConfigKey enum is a frequent source of bugs when changes are made to the config. One reason for this is because its values can be any string and don't necessarily need to be valid paths to the config object.

This PR tightens the typing for this enum such that any path not in SystemConfig is an error. To be able to do this, I changed it from an explicit enum to a constant object.

This PR includes the fix in #8579.

How Has This Been Tested?

Tested that the server starts up, that admin settings are changed successfully, and of course that invalid paths are caught by TypeScript.

Copy link

cloudflare-pages bot commented Apr 7, 2024

Deploying immich with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3597791
Status: ✅  Deploy successful!
Preview URL: https://75a959bf.immich.pages.dev
Branch Preview URL: https://chore-server-config-key-type.immich.pages.dev

View logs

@mertalev mertalev force-pushed the chore/server-config-key-type branch from e07d62b to 031c569 Compare April 7, 2024 01:38
@mertalev mertalev enabled auto-merge (squash) April 7, 2024 01:42
@mertalev mertalev merged commit 335c03d into main Apr 7, 2024
24 checks passed
@mertalev mertalev deleted the chore/server-config-key-type branch April 7, 2024 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants