Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 26 16:41

    vlovgr on ce3

    WIP (compare)

  • Oct 26 16:18

    vlovgr on ce3

    WIP WIP (compare)

  • Oct 26 09:18

    vlovgr on gh-pages

    Deploy website Deploy website … (compare)

  • Oct 26 09:13

    mergify[bot] on master

    Update scalafmt-core to 2.7.5 Change to enable docstrings.bla… Merge pull request #394 from sc… (compare)

  • Oct 26 09:13
    mergify[bot] closed #394
  • Oct 26 09:13
    codecov[bot] commented #394
  • Oct 26 09:09
    vlovgr synchronize #394
  • Oct 26 09:05

    vlovgr on ce3

    WIP (compare)

  • Oct 26 09:04
    vlovgr closed #392
  • Oct 20 01:50

    vlovgr on gh-pages

    Deploy website Deploy website … (compare)

  • Oct 20 01:45

    mergify[bot] on master

    Update sbt to 1.4.1 Merge pull request #397 from sc… (compare)

  • Oct 20 01:45
    mergify[bot] closed #397
  • Oct 20 01:45
    codecov[bot] commented #397
  • Oct 20 01:41
    scala-steward opened #397
  • Oct 19 17:29

    vlovgr on gh-pages

    Deploy website Deploy website … (compare)

  • Oct 19 17:24

    mergify[bot] on master

    Update sbt-mima-plugin to 0.8.1 Merge pull request #396 from sc… (compare)

  • Oct 19 17:24
    mergify[bot] closed #396
  • Oct 19 17:24
    codecov[bot] commented #396
  • Oct 19 17:20
    scala-steward opened #396
  • Oct 17 21:17

    vlovgr on gh-pages

    Deploy website Deploy website … (compare)

Bunyod
@Bunyod

Hello guys!

I have a small question. If I understand correctly we cannot load configuration from resources folder (as we do with pureconfig) and ciris is environment based config loader, right?

what I'm trying to do is like this:
env("APP_ENV").as[AppEnvironment].option.flatMap {
      case Some(AppEnvironment.Dev) | None =>
        ConfigValue.default[Config](ConfigSource.default.loadOrThrow[Config]) // trying to load with pure config. there are refined types 
      case _ =>
        (
          ... // read from env and validate, build ConfigValue with parMapN manually
        )
}
Cory Parent
@goedelsoup
there is also https://github.com/2m/ciris-hocon but I'm not sure if it's compatible with the version of ciris you are running
Cory Parent
@goedelsoup
ciris is really a configuration algebra which provides a few implementations in the core. you can really read anything using the functions provided in the companion object of ConfigValue. for example, i've created methods to read from hashicorp consul and vault for my company's internal use.
Viktor Lövgren
@vlovgr
@Krever has started working on a ciris-hocon integration (vlovgr/ciris#284) if that's what you're looking for @Bunyod
Bunyod
@Bunyod
OK, thank you very much guys. l look forward to that pr merged
Wojtek Pituła
@Krever
Sadly I had to stop in the middle. You can pick it up if you wish. I planned to get back to it as soon as I have a need for this again, which I estimate to happen in 3-6 months...
Bunyod
@Bunyod
@Krever I see, will try
Jente Hidskes
@Hjdskes
Hey people! Awesome library, I'm really enjoying it :) The SSM integration module especially is nice!
That said, I do have a question. Is there already a ConfigDecoder[String, Json] out there, or maybe even something more generic that allows me to have a ConfigDecoder[String, A] for any A with a Circe Decoder[A]?
Jente Hidskes
@Hjdskes

I've written one for the latter case:

  implicit def circeConfigDecoder[A: Decoder]: ConfigDecoder[String, A] =
    ConfigDecoder[String].mapEither {
      (_, s) => decode[A](s).leftMap {
          case ParsingFailure(message, _) => ConfigError(message)
          case DecodingFailure(message, _) => ConfigError(message)
      }
    }

This requires the circe-parser module from circe.

Viktor Lövgren
@vlovgr
@Hjdskes I'd happily accept a pull request for a ciris-circe module. :)
Jente Hidskes
@Hjdskes
@vlovgr I'll see what I can do in the time that I have :)
Viktor Lövgren
@vlovgr
@Hjdskes forgot to mention circe support was added in v1.1.1 (https://github.com/vlovgr/ciris/releases/tag/v1.1.1) in case you missed it.
Jente Hidskes
@Hjdskes
I hadn't checked yet, but that's cool! Thanks for notifying me :)
Keir Lawson
@keirlawson
Would it make sense to add a convenience method to ConfigValue[Secret[A]]to turn it in to a ConfigValue[A], ie the inverse of .secret? Obviously it is fairly simple to do .map(_.value) so perhaps not worth it? It would be useful in the case that you have values stored in some sort of secrets vault that would by default return them wrapped in Secret
Viktor Lövgren
@vlovgr
@keirlawson don't think it's worth it since, as you're saying, it's just .map(_.value)
Is that something internal which returns ConfigValue[Secret[A]] by default?
I think the third-party libraries are all unassuming and return ConfigValue[A].
Keir Lawson
@keirlawson
Yea, I made a ciris-aws-secretsmanager (to be open sourced soon!) that returns ConfigValue[Secret[String]] as it felt like that's what you would want in most cases...
Viktor Lövgren
@vlovgr
@keirlawson Nice. Is it much different from https://github.com/ovotech/ciris-aws-ssm ?
Keir Lawson
@keirlawson
nope, its a fork and then a very minor reworking :D
Jente Hidskes
@Hjdskes
Hey folks, quick question: if I'm fetching multiple parameters from SSM with ciris-aws-ssm, should I reuse the Param I get from Blocker[F].flatMap(params[F]) as much as possible, or is it fine to split credential fetching over multiple functions each of which calls Blocker[F].flatMap(params[F])?
Viktor Lövgren
@vlovgr
@Hjdskes You can reuse it. It's basically shown in the readme: https://github.com/ovotech/ciris-aws-ssm
Jente Hidskes
@Hjdskes
@vlovgr I know I can, I was wondering if I should :)
Viktor Lövgren
@vlovgr
@Hjdskes Yes, you should. It means you reuse the aws client and don't create+close a new client for every param.
Jente Hidskes
@Hjdskes
Cool, thanks @vlovgr !
Jakub Kozłowski
@kubukoz
Hi @vlovgr, have you investigated providing an Async[ConfigValue] instance? I was wondering if I could use a method like def foo[F[_]: Async] to write a custom config source.
Stack safety of flatMap might be an issue...
hmm, there is FlatMap[ConfigValue] already
I guess final def eval[F[_], A](value: F[ConfigValue[A]])(implicit F: Effect[F]): ConfigValue[A] might be my workaround.
Jakub Kozłowski
@kubukoz
btw. is there no generic derivation in ciris at the moment?
Viktor Lövgren
@vlovgr
@kubukoz Yes, flatMap cannot be expressed in a stack-safe manner, and also pure would not be what you expect, as discussed here: https://gitter.im/vlovgr/ciris?at=5dc6643b5eb2e813dbf0f3b0
There is no generic derivation, partly because there is no 'one way' to generically read a configuration.
There's also ConfigValue.async if you really need something like Async[ConfigValue].
Jakub Kozłowski
@kubukoz
For derivation, I had "one way" when you have ConfigValue instances for all the fields - but I get that it might be specific to my usecase... Maybe a module with optional derivations would be good to have, so that people don't need to reinvent the wheel if they want that?
Viktor Lövgren
@vlovgr
I'm not sure it's worth having that to just eliminate some (a, b, c, ...).parMapN(apply). Or is there something I'm missing?
I guess you also run into problems if you have two or more of the same type in your product, but want to read them differently.
Jakub Kozłowski
@kubukoz
it was that parMapN, yeah
two of the same type shouldn't be a problem for me, so I guess it's just one of the patterns
at the root type there will always be distinct types, but I see why it might not be true in the nested ones
have there been any attempts to integrate with cats-effect 3 milestones yet, @vlovgr ?
Viktor Lövgren
@vlovgr
@kubukoz yes, you can preview at https://github.com/vlovgr/ciris/compare/ce3
Biggest change with that proposal is ConfigValue[+F[_], A], similar to fs2's Stream.
Jakub Kozłowski
@kubukoz
Basically going tagless instead of free?
(didn't click yet, just judging by what the type param can get us)
Viktor Lövgren
@vlovgr
It's basically because eval/evalMap can't be expressed nicely otherwise.