Environment variable configuration using API #1936
Comments
The environment variable docs have now been clarified. We plan on adding optional environment variable config to 5.1 as well. The Spring Boot issue is something I am not sure we should address on that page. Our dedicated Spring Boot page may be a good place for that though. |
Hey Axel, thanks for the fast reaction! Your edit to the env vars page looks good to me. For Spring Boot I understand that it's also been documented there before - implicitely:
But maybe one could extend this to make it a bit more explicit?
|
@PeterWippermann Good suggestion. I have integrated it (with slightly different wording). |
Thank you! :-) |
Actually I was to leave this open until support for env vars configuration using the API is implemented. |
This has now been implemented. Flyway's envVars can now be used for configuration via the API by calling the |
I think the documentation about env vars needs some more clarification.
First of all, I thought configuration set in env vars would always be considered, but as far as I understand only the Maven and Gradle integrations obey these variables since they use the
ConfigUtil
. In other words, settings env vars has no effect on the Java API as long as I instantiate Flyway by myself:new Flyway()
. On the Java API I'm expected to call the configuration setters (setCleanDisabled(...)
) also before using the Flyway object.In addition, things behave different for the Spring Boot Autoconfiguration. If I'm having my Flyway object injected, Spring Boot will configure it for me - by using Spring's configuration enviroment. Thus I can use environment variables here, but I have to stick to Spring's property notation, e.g.
flyway.clean-disabled=true
.I had to learn this the hard way. Could you please clarify this in the documentation?
The text was updated successfully, but these errors were encountered: