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

Environment variable configuration using API #1936

Closed
PeterWippermann opened this issue Feb 26, 2018 · 6 comments
Closed

Environment variable configuration using API #1936

PeterWippermann opened this issue Feb 26, 2018 · 6 comments

Comments

@PeterWippermann
Copy link

@PeterWippermann PeterWippermann commented Feb 26, 2018

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?

@axelfontaine axelfontaine changed the title Documentation of environment variables is misleading Environment variable configuration using API Feb 26, 2018
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Feb 26, 2018

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.

@PeterWippermann
Copy link
Author

@PeterWippermann PeterWippermann commented Feb 27, 2018

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:

You can then configure a good number of Flyway properties directly from your application.properties or application.yml file.

But maybe one could extend this to make it a bit more explicit?

You can then configure a good number of Flyway properties directly from your application.properties or application.yml file. In Spring Boot, this configuration can also be moved to the system's environment variables. Be aware that the properties' notation is different then compared to Flyway's native support for environment variables.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Feb 27, 2018

@PeterWippermann Good suggestion. I have integrated it (with slightly different wording).

@PeterWippermann
Copy link
Author

@PeterWippermann PeterWippermann commented Feb 28, 2018

Thank you! :-)

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Mar 1, 2018

Actually I was to leave this open until support for env vars configuration using the API is implemented.

axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Mar 1, 2018
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Mar 1, 2018

This has now been implemented. Flyway's envVars can now be used for configuration via the API by calling the envVars() method on the configuration object.

dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.