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

[proposal] Implement environment variables support for options #30

Open
thibaultcha opened this issue Jun 7, 2017 · 4 comments
Open

Comments

@thibaultcha
Copy link
Member

thibaultcha commented Jun 7, 2017

Hi,

Would a contribution adding support for environment variables be accepted for options such as -c or --nginx?

The use case is using resty in a shebang as such:

#!/usr/bin/env resty -c 1024

This will only work on BSD-like platforms, and not Linux. We can mitigate this if we implement:

$ export RESTY_CLI_CONNECTION_COUNT=1024
$ export RESTY_CLI_NGINX=/path/to/nginx

Does this make sense? Which options would we like to see an environment variable for? I am thinking all but -e and the include directives (http, main, and -I), but let me know if not. Would you accept a contribution for RESTY_CLI_CONNECTION_COUNT only?

Thanks!

@agentzh
Copy link
Member

agentzh commented Jun 8, 2017

@thibaultcha All look good to me.

@ghprince
Copy link

ghprince commented Mar 6, 2018

+1 on this feature. Currently we use some wrapper scripts to workaround this on Linux. Environment variables seems to be a cleaner solution.

@bungle
Copy link
Member

bungle commented May 31, 2022

Does:

#!/usr/bin/env -S resty -c 1024

work with Linux these days?

@zhuizhuhaomeng
Copy link
Contributor

zhuizhuhaomeng commented Jun 1, 2022

@bungle Yes, it works.
for example

test.lua

#!/usr/bin/env -S resty -c 1024

print("hello")

chmod +x t.lua
./t.lua

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

No branches or pull requests

5 participants