-
Notifications
You must be signed in to change notification settings - Fork 7
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to customize the Mongod configuration properly in a Spring Boot context? #11
Comments
@enolive thats one way to go .. you can set the base dir also with an env variable as you can see here: https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo/blob/main/src/main/java/de/flapdoodle/embed/mongo/transitions/ExtractFileSet.java#L60 You can also use: Start.to(PersistenDir::class.java) .. this way it will be evaluated later.. and you must handle a possible IOException .. in this case it will be mapped to a RuntimeException .. There are at least two options .. a) use the builder pattern, b) use method overrides.. but i had some strange case, where this did not work in one case.. so builder pattern should work.. |
@enolive spring 3.x changed some internals .. i have to find a way to restore this port handling from 2.7.x somehow... |
thanks for your helpful pointers! While the ENV variable solution would be a very elegant solution to my nasty CI/CD problem, it would force me to scatter the embedded mongo configuration to different locations which I'd like to avoid. I like the |
@enolive there will be a new version soon .. |
I am similarly looking for a way to configure the storage directory of the embedded database. With Spring's old implementation this used to be accomplished by setting I tried |
@mcordeiro73 ah.. ok. I think i can reimplement this feature .. |
@mcordeiro73 feature is back as you can see here: https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo.spring/blob/main/HowTo.md#custom-database-dir .. you must use de.flapdoodle.mongodb.embedded.databaseDir (backport to my spring3.0.x, spring2.7.x and spring2.6.x adapter) .. can you close this, if this works for you? .. and if not, please open an new issue:) |
@michaelmosmann The property worked great. Not sure I can close the issue since I didn't open it. @enolive would you like to do the honors? |
@mcordeiro73 @enolive .. so i will close this:) |
I am struggling to find a proper way to customize the embedded mongo.
I am looking for a way to override
$HOME/.embedmongo
which won't work correctly on our CI/CD system (for reasons 馃槈)I am aware of the Customizations described in the Howto Document but I am not sure if I adapted it correctly to a Spring Boot Application. I am also aware that I can easily set the mongo version with the property
de.flapdoodle.mongodb.embedded.version
Problems that I see:
net
property, Spring Boot tries to connect to the default mongo port (27017) which will fail. I got this hack by looking at the internals ofEmbeddedMongoAutoConfiguration
PersistentDir.inWorkingDir
returns aThrowingSupplier
I have no clue how to use properly in a Transition. Usingget()
seems like a dirty hack on an "Either-like" data typeas you might see, I am using Kotlin. I can also provide a Java sample instead if needed!
The text was updated successfully, but these errors were encountered: