Skip to content

Commit 962cbf9

Browse files
authored
Merge pull request #338 from worzel666/netrc
Add support for netrc for private mirrors
2 parents c3c2b61 + 4c3abe9 commit 962cbf9

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
@@ -216,6 +216,18 @@ e.g.
216216
$ TFENV_TERRAFORM_VERSION=latest:^0.11. terraform --version
217217
```
218218

219+
##### `TFENV_NETRC_PATH`
220+
221+
String (Default: "")
222+
223+
If not empty string, this variable specifies the credentials file used to access the remote location (useful if used in conjunction with TFENV_REMOTE).
224+
225+
e.g.
226+
227+
```console
228+
$ TFENV_NETRC_PATH="$PWD/.netrc.tfenv"
229+
```
230+
219231
#### Bashlog Logging Library
220232

221233
##### `BASHLOG_COLOURS`

lib/helpers.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,13 @@ function curlw () {
134134
TLS_OPT="";
135135
fi;
136136

137-
curl ${TLS_OPT} "$@";
137+
if [[ ! -z "${TFENV_NETRC_PATH:-""}" ]]; then
138+
NETRC_OPT="--netrc-file ${TFENV_NETRC_PATH}";
139+
else
140+
NETRC_OPT="";
141+
fi;
142+
143+
curl ${TLS_OPT} ${NETRC_OPT} "$@";
138144
}
139145
export -f curlw;
140146

0 commit comments

Comments
 (0)