-
Notifications
You must be signed in to change notification settings - Fork 66
make generate_managed always cleanup the container
#177
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
base: main
Are you sure you want to change the base?
Conversation
I stumbled with cornucopia-rs#146 while experimenting with cornucopia, so I thought it would be okay to propose a fix. Fixes cornucopia-rs#146
|
Thanks for your contribution 😄 The reason we don't always clean up is to make it possible to inspect the database after a codegen failure. Obviously this is pretty niche, and I agree that cleanup-on-failure should be the default, but this PR would make it basically impossible to inspect a DB container after a cornucopia error. Perhaps we ought to add a |
|
I think it's a good idea to pass this option. Furthermore, I've been thinking about how to better expose this kind of configuration on cornucopia. Maybe a builder style would be more interesting, as it would be more flexible on adding new fields without breaking compatibility. What do you think about it? This way, we could add new fields with default values without making users change their code. ManagedGenerator::new(
CodegenSettings::async_code(),
vec!["schema.sql".to_string()],
)
.use_docker()
.destination("destination.out")
.generate()
.unwrap();If you like the idea, I can finish the implementation and update this PR. Changing subject... I noticed that there's some fields which are used as path to directories and files, but are typed as &str and String. If we're willing to break the API to make some cleanup, we could change them to Path or PathBuf to better represent their use. |
I really like this idea.
I don't have a strong opinion on this, but I'm not opposed. As you mention, this could make the intent clearer. Thanks for you contributions, much appreciated 😄 |
|
@LouisGariepy there's another reason one might want to use If it's a user facing function one can also go the route of using |
|
Agreed! |
I stumbled with #146 while experimenting with cornucopia, so I thought it would be okay to propose a fix.
Fixes #146