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

Support TestSystem in Typesafe Config provider #1241

Open
przemek-pokrywka opened this issue Aug 9, 2023 · 2 comments
Open

Support TestSystem in Typesafe Config provider #1241

przemek-pokrywka opened this issue Aug 9, 2023 · 2 comments

Comments

@przemek-pokrywka
Copy link

Until #1053 gets completed, the TestSystem is basically ignored in the integration with Typesafe Config.

Even though the external library does not support overriding of the System class method calls, there would be a way around this. Both system properties and the environment variables can be altered globally (the latter using a reflection hack), so the only remaining part is to assure, that all Typesafe Config reads are done sequentially - which should be possible using a JVM-global semaphore.

This would unblock testing of how do the environment variables resolve to the configuration values in complex cases.

Another advantage of the proposal is that it's safer for legacy apps (which use complex HOCON configurations already) since all the undocumented quirks of the 3rd party library would work as before. That would make it less risky to port them to ZIO.

@przemek-pokrywka
Copy link
Author

Would anyone be interested in a PR with the changes described above?

@przemek-pokrywka
Copy link
Author

Both system properties and the environment variables can be altered globally (the latter using a reflection hack)

Since the hack will only work on certain JVMs, the code would need to check if using it is possible, and if not, then a descriptive exception should be thrown.

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

No branches or pull requests

1 participant