whiteinge/ok.sh

About authentication (netrc), add an environment for authentication.

0xfe10 opened this issue · 1 comments

Now ok.sh uses .netrc file for authorization verification, This is available in most cases.

But in some special cases, this doesn't work very well. like Travis CI.

If Travis CI set a no display value environment, unable to generate .netrc file. and then call some api will return Client Error: 401 Unauthorized

Is it possible to add an environment variable?

like this

https://github.com/whiteinge/ok.sh/blob/master/ok.sh#L697

curl -nsSig \
    -H "Accept: ${OK_SH_ACCEPT}" \
    -H "Content-Type: ${content_type}" \
    ${etag:+-H "If-None-Match: \"${etag}\""} \
    ${GITHUB_TOKEN:+-H "Authorization token ${GITHUB_TOKEN}"} \
    ${has_stdin:+--data-binary @-} \
    ${trace_curl:+--trace-ascii /dev/stderr} \
    -X "${method}" \
    "${path}"

Yeah, that would be a great addition. Do you mind making a PR to add it?