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

Fill missing settings with default values #298

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

Conversation

gazben
Copy link

@gazben gazben commented Oct 18, 2024

Currently if you deploy a new version to a server and the migrations are still running you get a MissingSettings exception. For long running migrations and big deployments this can be a problem.

This proposal adds a fallback option to settings defined in the Settings object. If you set the default in the code the settings mapper will return that default value instead of throwing an exception. For nullable values the default will be null without changing anything in the Settings object.

Example:

    // Returns false without migrations
    public bool $mySetting = false;
    // Returns null
    public ?string $myOtherSetting;
    // Fails
    public string $myOtherSetting;

What do you think about this proposal?

Credits to @andrasszommer

@LarsWiegers
Copy link

Love this and definitely a good idea

@mrmmg
Copy link

mrmmg commented Jan 7, 2025

YES, I upvote this PR!

After 3 hours of debugging this issue, I opened issue #307.

Please merge this PR into package!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants