-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add support for template args #255
Conversation
Thank you @chriswells0 for doing this work. I really like to see this feature in Bastille. Adding One thing I cannot get to work is the
Also, I noticed a small usage "issue": if the Except that, this is pretty awesome and if there is anything I can help with to get this into Bastille, let me know. P.S.: One thing I'm missing, which might not be part of this pull request, is the ability to use
|
9dfb864
to
baf36e8
Compare
I had a double
I toyed with that idea also, but I left it out because forcing a value to be provided means optional values aren't possible. I'm open to feedback on it, but that was my reasoning. In general, it would be good to follow how it works in a Dockerfile--not because "they're always right" but because it makes for an easier back and forth transition for users. I checked their docs and found this:
That seems like a good approach: a warning message in yellow or whatever color existing Bastille warnings use. What do you think?
Funny enough, your example (except for Apache) is the use case I have that made me want to implement this feature. I just haven't made the time to actually work on my template, so I haven't looked at how I would do it. I'm hesitant to change every file copied into a jail, because that could lead to unexpected results (imagine a script that looks for a placeholder having its placeholder replaced with a value). Plus, it would mean we have to recursively iterate every file being copied in, which is far more complicated than the bulk copies that are happening now. In thinking about it briefly, it seems letting the user include their own script to update specific files makes sense. I've done that in Docker for NGINX deployments except in the entrypoint script, which we don't have. For us, it could be called in the template and passed the values it needs (substituted at time of execution): Thoughts? |
Works like a charm now.
Just a little side note: right now they are not optional values as well. They are just empty. If you would want to have a default empty value, it could be defined like
Perfect solution for me.
Yeah, it should not be the default behaviour of
Thats how I implemented it right now, but I see one problem with this approach: everyone would need to implement the replacement of the variables themselves. From what I understand Bastille should make the life in jails easier. What about a new statement: This would also make the use of What do you think? |
I had thought about a new command for it also, but I was hesitant to create a new one. I could add and see what @cedwards thinks about it. Maybe something related to args to make it clear? I don't know if I'll be able to get to it this weekend. I'm replacing the kitchen sink and faucet, and I had to replace the pipes to get everything aligned. :( |
I think from these options I like |
Closes 211.
baf36e8
to
2225f48
Compare
My apologies for the delay. I've pushed an update for this PR to add the warning about empty arg values. There is also a new |
Thank you! I'll test this as soon as possible! |
One thing which might be nice: display the template that is processed and where it is stored (like Thank you again @chriswells0 for working on this! |
Arguments can be defined in a Bastillefile using
ARG
:An
ARG
file can also be used to define a list of variables one per line (e.g., for use in template hooks).Values can be provided individually when applying the template:
They can also be placed one per line in a file such as values.txt:
Then provide the file name using
--arg-file
:Note that in both cases, only variables defined via
ARG
(command or hook file) will have their values replaced.Closes #211