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

Config does not load optional settings from defaults #3197

Open
JPSchellenberg opened this issue Sep 20, 2023 · 6 comments
Open

Config does not load optional settings from defaults #3197

JPSchellenberg opened this issue Sep 20, 2023 · 6 comments
Assignees
Labels
[type] bug Something isn't working (resulting in patch-version)

Comments

@JPSchellenberg
Copy link
Member

If an option is passed via the defaults object, but not defined in the initial config, it is not loaded.
For example: contentFilesUrlPlayerOverride is not defined in the initial config. It is impossible to pass this setting in the defaults object passed in the constructor.

@JPSchellenberg JPSchellenberg added the [type] bug Something isn't working (resulting in patch-version) label Sep 20, 2023
@JPSchellenberg JPSchellenberg self-assigned this Sep 20, 2023
@JPSchellenberg
Copy link
Member Author

The easiest solution would be to remove the if-statement in line 19. I don't think that this if-statement is really neccessary. @sr258 Would you agree to remove it?

@sr258
Copy link
Member

sr258 commented Sep 20, 2023

The change would not make the class load the values from storage, but from the override defaults and saving would still have the same problem.

@JPSchellenberg
Copy link
Member Author

Could you elaborate? I don't see how this would prevent loading values from storage. The if statement just prevents loading settings from the defaults-override that are not previously defined as far as I can see.
This problem occurs if you are not using a file, but in-memory-storage. Certain values are passed as environment-variables.

@sr258
Copy link
Member

sr258 commented Sep 20, 2023

It doesn't prevent it, but also doesn't replace it. I would simply use a totally different class if you need some other behavior. The IH5PConfig interface is deliberately meant to be an interface, because you can simply plug in you own implementation.

@JPSchellenberg
Copy link
Member Author

I don't need any other behavior. I think it is a little bit confusing to have an option in the configs listed (in this example contentFilesUrlPlayerOverride), but if you pass it via the defaults-object in the constructor it won't work. I just want to be able to provide the documented options via the default object.

@sr258
Copy link
Member

sr258 commented Sep 20, 2023

The if statement looks like I put it in deliberately for some reason. You're right that the JavaDocs comment doesn't match the behavior, though. You can change it, but you should check if the samples all still work as they currently do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[type] bug Something isn't working (resulting in patch-version)
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants