Skip to content
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

Closed
Leopere opened this issue Jun 5, 2019 · 11 comments · May be fixed by #120
Closed

Accept environment variables as answers. #21

Leopere opened this issue Jun 5, 2019 · 11 comments · May be fixed by #120
Labels
enhancement New feature or request

Comments

@Leopere
Copy link
Contributor

Leopere commented Jun 5, 2019

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.

@angristan
Copy link
Owner

Something like angristan/openvpn-install#261

@angristan angristan added the enhancement New feature or request label Jun 6, 2019
@liberodark
Copy link

#46 if you want have possibility to make this but have add a good system -install or -remove next is for add more clients

@randshell
Copy link
Contributor

Something like angristan/openvpn-install#261

angristan/openvpn-install#592 should be considered too

@Leopere
Copy link
Contributor Author

Leopere commented Jul 5, 2020

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.

@randshell
Copy link
Contributor

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.

@Leopere
Copy link
Contributor Author

Leopere commented Jul 6, 2020 via email

@AndreiG6
Copy link

AndreiG6 commented Jul 7, 2020

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:

$ cat things.sh
echo ${lolwat:-things}
$ bash things.sh 
things
$ 

vs

$ lolwat=omgursh bash things.sh 
omgursh
$ 

@Leopere
Copy link
Contributor Author

Leopere commented Jul 7, 2020 via email

@AndreiG6
Copy link

AndreiG6 commented Jul 7, 2020 via email

@randshell
Copy link
Contributor

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

@Leopere
Copy link
Contributor Author

Leopere commented Jul 7, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants