Giter VIP home page Giter VIP logo

ciris-kubernetes's People

Contributors

gordon-rennie avatar jakobmerrild avatar jensraaby avatar keirlawson avatar msinton avatar rmorais avatar scala-steward avatar vlovgr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ciris-kubernetes's Issues

Support default and optional ConfigMap values

Firstly, thanks for the library!

ciris supports optional and default values (see e.g. ConfigValue#option,) which returns an empty, or a specified default value, if a ConfigValue contains an error with error.isMissing = true.

It is not possible to use this functionality in ciris-kubernetes for values inside a ConfigMap, because if no value is found for the key then a generic ConfigError.failed is returned instead of a ConfigError.missing. Calls to .option will not recover from the error to an empty value.

The relevant code here:

private[this] final def selectConfigEntry[A](
key: Option[String],
configKey: ConfigKey,
entries: Map[String, A]
): ConfigValue[A] = {
def availableKeys = s"available keys are: ${entries.keys.toList.sorted.mkString(", ")}"
key match {
case Some(key) =>
entries.get(key) match {
case Some(value) =>
ConfigValue.loaded(configKey, value)
case None =>
ConfigValue.failed {
ConfigError {
s"${configKey.description.capitalize} exists but there is no entry with key [$key]; $availableKeys"
}
}
}

I have a use case where I'd like to have an optional config param inside a configmap. If this isn't objectionable, the fix seems pretty straight forward and I'm happy to put in the PR to change to return a ConfigError.missing here:

case None =>
ConfigValue.failed {
ConfigError {
s"${configKey.description.capitalize} exists but there is no entry with key [$key]; $availableKeys"
}

Setup CI

Setup CI so pull requests can be verified before merge

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.