Skip to content

Commit 4c3abe9

Browse files
author
Jack Parsons
committed
Add support for netrc for private mirrors
1 parent 7e89520 commit 4c3abe9

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,18 @@ e.g.
209209
$ TFENV_TERRAFORM_VERSION=latest:^0.11. terraform --version
210210
```
211211

212+
##### `TFENV_NETRC_PATH`
213+
214+
String (Default: "")
215+
216+
If not empty string, this variable specifies the credentials file used to access the remote location (useful if used in conjunction with TFENV_REMOTE).
217+
218+
e.g.
219+
220+
```console
221+
$ TFENV_NETRC_PATH="$PWD/.netrc.tfenv"
222+
```
223+
212224
#### Bashlog Logging Library
213225

214226
##### `BASHLOG_COLOURS`

lib/helpers.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ function curlw () {
116116
TLS_OPT="";
117117
fi;
118118

119-
curl ${TLS_OPT} "$@";
119+
if [[ ! -z "${TFENV_NETRC_PATH:-""}" ]]; then
120+
NETRC_OPT="--netrc-file ${TFENV_NETRC_PATH}";
121+
else
122+
NETRC_OPT="";
123+
fi;
124+
125+
curl ${TLS_OPT} ${NETRC_OPT} "$@";
120126
}
121127
export -f curlw;
122128

0 commit comments

Comments
 (0)