-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Accept environment variables as answers. #21
Comments
Something like angristan/openvpn-install#261 |
#46 if you want have possibility to make this but have add a good system -install or -remove next is for add more clients |
angristan/openvpn-install#592 should be considered too |
It really wouldn't be big trouble to add a function for checking the state of a variable, if the variable. https://www.cyberciti.biz/faq/unix-linux-bash-script-check-if-variable-is-empty/ that can be fairly easily inserted in near the beginning and then the rest of the script can function basically the same. This way you could use this in headless deployments. |
I can't really work on it until my refactoring PRs are reviewed and eventually merged as they conflict with each other and working on master isn't an option. After if you like you can open a PR for this too, the codebase will be similar to the openvpn-install repo. |
Hey I’m in zero rush in the meantime I’ll just keep using that
complexorganizations script.
…On Mon, Jul 6, 2020 at 2:49 PM randomshell ***@***.***> wrote:
It really wouldn't be big trouble to add a function for checking the state
of a variable, if the variable.
I can't really work on it until my refactoring PRs are reviewed and
eventually merged as they conflict with each other and working on master
isn't an option. After if you like you can open a PR for this too, the
codebase will be similar to the openvpn-install repo.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#21 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIE2VSDKGCPVORZPES6CTDR2IMDRANCNFSM4HTZ4GHQ>
.
|
This is actually way easier than using if's and should not require any major code changes. Ignore everything you see in that cyberciti.biz link. You can simply use bash variable substitution. For example:
vs
|
Makes sense to me but it might be keen to call a check as a function.
…On Mon, Jul 6, 2020 at 8:36 PM Andrei D. ***@***.***> wrote:
This is actually way easier than using if's and should not require any
major code changes. *Ignore everything you see in that cyberciti.biz
<http://cyberciti.biz> link.* You can simply use bash variable
substitution. For example:
$ cat things.sh
echo ${lolwat:-things}
$ bash things.sh
things
$
vs
$ lolwat=omgursh bash things.sh
omgursh
$
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#21 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIE2VQOWMUYPVIGYZVC2N3R2JUXVANCNFSM4HTZ4GHQ>
.
|
Why have a function check for a variable and replace the default value vs
just allowing substitution on the default var. Bash variable substitution
is there to avoid extra checks and have a viable default fallback
…On Tue, Jul 7, 2020, 04:14 Leopere ***@***.***> wrote:
Makes sense to me but it might be keen to call a check as a function.
On Mon, Jul 6, 2020 at 8:36 PM Andrei D. ***@***.***> wrote:
> This is actually way easier than using if's and should not require any
> major code changes. *Ignore everything you see in that cyberciti.biz
> <http://cyberciti.biz> link.* You can simply use bash variable
> substitution. For example:
>
> $ cat things.sh
> echo ${lolwat:-things}
> $ bash things.sh
> things
> $
>
> vs
>
> $ lolwat=omgursh bash things.sh
> omgursh
> $
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <
#21 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAIE2VQOWMUYPVIGYZVC2N3R2JUXVANCNFSM4HTZ4GHQ
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#21 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE6DR6CNXRJKFUZGMZHKC6TR2JZHLANCNFSM4HTZ4GHQ>
.
|
We aren't going to use functions but variable substitution like it was already done in the openvpn-install repo https://github.com/angristan/openvpn-install/blob/eca5be8aacc54a570bb3c5306d8764e1be3cab79/openvpn-install.sh#L603-L605 |
Eh that could be fine i do like that solution but just feels brutish like
there’s a lot of potential failure modes where if there’s a good system for
capturing bad inputs in a callable bash function. Just making suggestions
I’m not able to spend time doing it.
If my suggestions get in the way obviously just do it there faster way.
…On Tue, Jul 7, 2020 at 12:07 AM Andrei D. ***@***.***> wrote:
Why have a function check for a variable and replace the default value vs
just allowing substitution on the default var. Bash variable substitution
is there to avoid extra checks and have a viable default fallback
On Tue, Jul 7, 2020, 04:14 Leopere ***@***.***> wrote:
> Makes sense to me but it might be keen to call a check as a function.
>
> On Mon, Jul 6, 2020 at 8:36 PM Andrei D. ***@***.***>
wrote:
>
> > This is actually way easier than using if's and should not require any
> > major code changes. *Ignore everything you see in that cyberciti.biz
> > <http://cyberciti.biz> link.* You can simply use bash variable
> > substitution. For example:
> >
> > $ cat things.sh
> > echo ${lolwat:-things}
> > $ bash things.sh
> > things
> > $
> >
> > vs
> >
> > $ lolwat=omgursh bash things.sh
> > omgursh
> > $
> >
> > —
> > You are receiving this because you authored the thread.
> > Reply to this email directly, view it on GitHub
> > <
>
#21 (comment)
> >,
> > or unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/AAIE2VQOWMUYPVIGYZVC2N3R2JUXVANCNFSM4HTZ4GHQ
> >
> > .
> >
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <
#21 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AE6DR6CNXRJKFUZGMZHKC6TR2JZHLANCNFSM4HTZ4GHQ
>
> .
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#21 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIE2VWVNCZJFIJSDBBFHITR2KNQJANCNFSM4HTZ4GHQ>
.
|
Would it be unreasonable to imagine a world where your Q&A system could be automated with the addition of bash environment variables? I think this would be incredibly useful if you already know the answers you want to give.
Otherwise, you could even have an option like $WIREGUARD-INSTALL-RECOMMENDS=True and it would just pick whatever you recommend by default and skip all other questions.
The text was updated successfully, but these errors were encountered: