resty-cli icon indicating copy to clipboard operation
resty-cli copied to clipboard

[proposal] Implement environment variables support for options

Open thibaultcha opened this issue 8 years ago • 4 comments

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!

thibaultcha avatar Jun 07 '17 23:06 thibaultcha

@thibaultcha All look good to me.

agentzh avatar Jun 08 '17 23:06 agentzh

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

ghprince avatar Mar 06 '18 07:03 ghprince

Does:

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

work with Linux these days?

bungle avatar May 31 '22 14:05 bungle

@bungle Yes, it works. for example

test.lua

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

print("hello")

chmod +x t.lua ./t.lua

zhuizhuhaomeng avatar Jun 01 '22 10:06 zhuizhuhaomeng