From e761bde963f005b4f8f0173d7f5445eb906e550d Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 3 Jan 2018 03:52:23 +0000 Subject: [PATCH] etc/profile.d/nb.sh --- etc/profile.d/nb.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/profile.d/nb.sh b/etc/profile.d/nb.sh index cf2db426..f7b39cdc 100644 --- a/etc/profile.d/nb.sh +++ b/etc/profile.d/nb.sh @@ -1,6 +1,8 @@ export NB_DB=nb -#=SHELL_REPLACE sudo awk -F '}' '/CLEARTEXT/{print "export NB_AUTH=\"nb:"$2"\""}' /etc/ldap/nbdom.net/auth/nb.ldif -export NB_AUTH="nb:0TXARcQUpjHZctoROA2X.weWSZKM5DGT" +NB_AUTH=$(awk '/^machine api.nbdom.net / { print $4":"$6}' $HOME/.netrc 2> /dev/null) +#=SHELL_REPLACE sudo awk -F '}' '/CLEARTEXT/{print "NB_AUTH=\"nb:"$2"\""}' /etc/ldap/nbdom.net/auth/nb.ldif +[ -z "$NB_AUTH" ] && NB_AUTH="nb:0TXARcQUpjHZctoROA2X.weWSZKM5DGT" +export NB_AUTH nb_repos_commit_push() { shell_help "Commit each repos whith a comment" "$@" && return @@ -81,6 +83,8 @@ nb_php() { nb_api() { local uri="$1"; shift + #local auth; [ -n "$NB_AUTH" ] && auth='-u "'$NB_AUTH'"' + #curl --netrc-optional -s "$auth" "https://api.nbdom.net$uri" "$@" curl --netrc-optional -su "$NB_AUTH" "https://api.nbdom.net$uri" "$@" } -- 2.47.3