dtanner / env-override Goto Github PK
View Code? Open in Web Editor NEWOverride an object with environment values
License: MIT License
Override an object with environment values
License: MIT License
e.g. @RequiresOverride
where it'll blow up if a property isn't overridden. maybe allow it at the class level and have an opposite annotation like @GlobalConfig that will let it be constant across envs.
Some users have been tripped up by the RequiresOverride annotation when they're in their dev environment, and aren't aware that you can disable it. Add a hint to the logs when halting the app on how to disable the check.
fun <T> T.withEnvOverrides(prefix: String, defaults: (T.() -> Unit)? = null): T {
val config = this
defaults?.invoke(config)
return EnvConfigLoader.overrideFromEnvironment(config, prefix)
}
sample usage:
val metricsConfig = MetricsConfig().withEnvOverrides("METRICS")
bind(MetricsConfig::class.java).toInstance(metricsConfig)
Maybe along with or instead of the java property name, include the expected environment variable name including the prefix. That's what the person is actually missing, and it'll help clarify which configuration they're referencing too.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.