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

ConfigProvider.fromYamlFile Is Not Sufficiently Lazy #1217

Open
adamgfraser opened this issue Jul 14, 2023 · 1 comment
Open

ConfigProvider.fromYamlFile Is Not Sufficiently Lazy #1217

adamgfraser opened this issue Jul 14, 2023 · 1 comment

Comments

@adamgfraser
Copy link
Contributor

The following application will throw an exception:

import zio.ConfigProvider
import zio.config.yaml._

import java.io.File

object Example extends App {

  val file = new File("???")

  val configProvider =
    ConfigProvider.fromYamlFile(file)
}

This should not occur because the ConfigProvider should be something that knows how to load a given configuration but should not actually do so until requested to by a ZIO application. The current behavior makes it impossible to recover from these types of errors using operators such as ConfigProvider#orElse or even for the ZIO runtime to properly manage them since they occur when the ConfigProvider is defined.

Note that ConfigProvider.fromHoconFile already handles this properly.

@afsalthaj
Copy link
Collaborator

I will take a look

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

2 participants