Skip to content

accessing environment variables from shebang recipes #1989

Closed Answered by laniakea64
willie asked this question in Q&A
Discussion options

You must be logged in to vote

If this is all one recipe, you could do something like

#!/usr/bin/env sh
set -euxo pipefail
export $(berglas exec -- env | grep AUTH_)
curl -v -u ${AUTH_USER}:${AUTH_PASSWORD} some_url

This is just the basic idea. That export line might be unsound if any of the AUTH_* variables could contain characters that are special to the shell, but there are other ways to extract the values from that command output for passing to export.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@willie
Comment options

@laniakea64
Comment options

@willie
Comment options

Answer selected by willie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants