I can read my kubernetes secrets when running the below but still trying to wrap my head around Cats IO. Is there just a recommended way for me to pass the values from the resulting IO[Config]
? So based on the example project the part that I'm confused by is the actual config passing. So if I have this:
def load: IO[Config] =
for {
apiClient <- defaultApiClient[IO]
secret = secretInNamespace[IO]("secrets", apiClient)
config <- configWith(secret).orRaiseThrowable
} yield config
how can I just get the config object and property values and pass it to an object file or function? ie.
def myPropertyFunc(cfg: Config) =
val myprop = cfg.http.host.value
The example project has code as follows which I'm not sure how to incorporate into my own simplified function:
Config.load.flatMap { config =>
IO(println(config.show)) >>
startHttpApi[IO](config)
}
Right now I can get to the property value as follows but looking for the recommended way instead: val myprop = load.unsafeRunSync().http.host.value