-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
I would like to add support for profiles:
src\resources\application.yaml
profile: {MY_PROFILE:local}
db:
url: {DB_URL}
login: {DB_LOGIN}
pass: {DB_PASS}src\resources\application-local.yaml
db:
url: my URL for local development
login: my login for local development
pass: my password for local development The idea is that when retrieving a parameter, we take the value not from the main config file but from the file specified in the profile.
Currently, to achieve this functionality, we'd have to write something like:
String dbUrl = new EVal(
"db.url",
String.format(
"src/resources/application-%s.yaml",
new EVal("profile").value()
)
).value();In general, things could get even worse because here we can't tell whether a profile exists or if the user forgot to specify its value (or if the value isn't set in the environment).
Ideally, I'd like to see something like:
String dbUrl = new EValProf("db.url").value();or
String dbUrl = new EValProf("db.url", "path_to_application.yaml").value();And, of course, error handling needs to be taken care of:
- If the
profileattribute is missing in application.yaml, simply fetch the attribute as usual—from application.yaml. - If the
profileattribute exists but its value is empty (or if it references an environment variable with no default value and that variable is empty), throw a clear error to the user whenvalue()is called. - If the
profileattribute exists, reuse theEValclass with the new path (as described at the beginning) and retrieve the desired value from the appropriate YAML file.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed