Client.sh: Read env file
Closed this issue · 5 comments
Currently in order to deploy multiple certificates on one machine, you'll need to copy the client file then modify the top rows in the file (to specify different certificate, key path, or to use different reload-cmd). To solve this, maybe it's better to optionally add a new command line argument -f
to specify a environment file? In that way, instead of current manual modifying the file, we can simply specify the environment file and use those specified on a per execution basis.
I have a patch ready to submit but not sure if you like that to be added to the source or not, so I decided to not include that in the current pull request #7
Do you mean that we can separate the configuration options into a configuration file and run client with a -f
argument to load configuration? Good idea. Just open pull request please! And thanks for your contributions meanwhile.
Do you mean that we can separate the configuration options into a configuration file and run client with a
-f
argument to load configuration? Good idea. Just open pull request please! And thanks for your contributions meanwhile.
Yup.
Now what I think would be a partial approach. Still leave domain, site, key and those command line arguments as is, then replace cert path, key path, full chain path, reload commands and work directory (aka anything that's specified in the file) with the "potential environment file".
That means, if -f
is specified and file exists, it would replace the environment variables listed in the file (with quotes and spaces support). If the -f does not exist, it would use the current approach.
The reason behind that is I simply don't want to break existing clients (or write additional logic to address those things for now).
I'll submit a PR for that and a minor reformat for the existing printf later today.
Umm... Just work like a plugin function. That also sounds good. I'll merge it. Thanks again!
Umm... Just work like a plugin function. That also sounds good. I'll merge it. Thanks again!
Yeah that's my plan for now (it's actually "good enough" for me at this moment). I tried to rewrite the code to maintain full compatibility while also having the new config version in, but that requires too many changes and I also have no clue on the arguments part... So that's all I have for now 😂.
If I have some spare time during next round I'll see if I can replace the current argument based system completely (and maybe also add to cron - via crontab)...
Okay. Thank you very much indeed. (^_−)☆