Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Add ability to fail fast by throwing an exception if a property is absent #14

Closed
ashtttt opened this issue May 17, 2020 · 2 comments
Closed
Labels
Milestone

Comments

@ashtttt
Copy link

ashtttt commented May 17, 2020

I am trying to use @EnvironmentVariable annotation, currently if annotated environment variable is not set in the deployed environment the fields are left with "null" value.
I can see we have option to set a default value, can we also have an option to throw an exception if a given environment variable is not set. This allows us to fail the applications during configuration initialization.

@fmbenhassine
Copy link
Member

Makes sense, as there is no way to fail fast currently. This can actually be added to all annotations. Let me plan this for next release. Thank you for raising this issue!

@fmbenhassine fmbenhassine changed the title Ability to throw exemption/reject if an Environment Variable is not set Add ability to fail fast by throwing an exception if a property is absent Jun 7, 2020
@fmbenhassine fmbenhassine added this to the 3.1.0 milestone Jun 7, 2020
@fmbenhassine
Copy link
Member

@ashtttt I added the ability to fail fast by throwing an exception if an environment variable is not set:

class Bean {
     @EnvironmentVariable(value = "absent", failFast = true)
     private String absentValue;
}

You can try it already with v3.1.0-SNAPSHOT.

Thank you for raising this issue!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants