From e2fe567df4871548664f6aa416dbae6fe4ccf657 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 18 Dec 2017 17:24:43 +0000 Subject: [PATCH] etc/profile.d/nb.sh --- etc/profile.d/nb.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/etc/profile.d/nb.sh b/etc/profile.d/nb.sh index d032e184..f4754b41 100644 --- a/etc/profile.d/nb.sh +++ b/etc/profile.d/nb.sh @@ -1,4 +1,5 @@ export NB_DB=nb +export NB_AUTH="nb:0TXARcQUpjHZctoROA2X.weWSZKM5DGT" nb_repos_commit_push() { shell_help "Commit each repos whith a comment" "$@" && return @@ -72,6 +73,11 @@ nb_perl() { ruby -r$NB_ROOT/lib/perl/NB -e "$@" } +nb_api() { + local uri="$1"; shift + curl -su "$NB_AUTH" "https://api.nbdom.net$uri" $@ +} + nb_api_post() { local usage="Usage: nb_api_post TABLE field1=val1 field2=val2 ..." local table="${1:?$usage}"; shift @@ -79,7 +85,7 @@ nb_api_post() { local host=$(hostname) [ -z "$host" ] && host=$(hostname -f) - local curl="curl -su nb:0TXARcQUpjHZctoROA2X.weWSZKM5DGT -H 'Accept: application/x-sh' https://api.nbdom.net/data/$table/replace -d host=$host" + local curl="nb_api /data/$table/replace.sh -d host=$host" while [ "$#" -gt "0" ]; do curl="$curl -d \"$1\"" @@ -87,7 +93,7 @@ nb_api_post() { done ( eval "$curl" - ) > /dev/null + ) #> /dev/null } nb_post_sys_infos() { -- 2.47.3