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

fr: ultra-simplified version using delegates #34

Open
salamanders opened this issue Oct 26, 2018 · 1 comment
Open

fr: ultra-simplified version using delegates #34

salamanders opened this issue Oct 26, 2018 · 1 comment

Comments

@salamanders
Copy link

I think that this would be an easy feature given the great foundation in this project, and what Kotlin can do with delegates.

In my class, I'd like to have magic delegated properties that take into account everything (SystemProperties, EnvironmentVariables, command line, and default values). I think it would be possible to do so in a way that a single import is all you need:

import com.natpryce.konfig.byConfig

class MyClass {
  val speed:Double = byConfig(0.0)
  val name:String = byConfig("Larry")
  init {
    println("My name is $name because of ${::name.source}")
  }
}
@boukeversteegh
Copy link

is byConfig supposed to take a default value or the name of a config parameter?

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