Skip to content

Commit 47769c7

Browse files
author
oglowa
committed
glo03-666: initial commit
1 parent 833cd4f commit 47769c7

File tree

2 files changed

+34
-15
lines changed

2 files changed

+34
-15
lines changed

script/common/env-restapi.sh

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,36 @@
66
# - Alternative: https://curl.se/windows/
77
#
88
# (c) 2024 Oliver Glowa (glo03) / Arvato Systems GmbH
9-
#
9+
#
1010
# !!!! Works only with privat access token (PAT) !!!!
1111

12-
TS=`date`
12+
if [ -f ~/.restapi/my.conf ]; then
13+
source ~/.restapi/my.conf
14+
else
15+
echo -e "No personal config found in ~/.restapi/my.conf!"
16+
exit 11
17+
fi
1318

14-
CONF_AUTH="Authorization: Bearer ${CONF_PAT_TEST}"
19+
CONF_BASE_URL=${MY_BASE_URL}
20+
CONF_AUTH="Authorization: Bearer ${MY_PAT}"
1521

16-
CONF_BASE_URL_TEST=https://nma-s-confluence-test.arvato-systems.de
17-
CONF_BASE_URL_INTE=https://nma-s-confluence-mig.arvato-systems.de
18-
CONF_BASE_URL=${CONF_BASE_URL_TEST}
22+
# Check
23+
if [ "${CONF_AUTH}" = "" ]; then
24+
echo -e "No PAT (personal access token) in environment defined!"
25+
exit 10
26+
fi
27+
28+
TS=`date`
1929

2030
CONF_RESTAPI_URL=${CONF_BASE_URL}/rest/api/content
2131
DL_DIR=${TEMP}
2232

2333
REQP_LIGHT='&expand=space'
2434
REQP_FULL='&expand=body.storage,version,space'
2535

26-
RESP_SINGLE='.id + " " + .space.key + " " + .title'
27-
RESP_RESULTS='.results[]| .id + " " + .space.key + " " + .title'
28-
RESP_BODY_SINGLE='.id + " " + .space.key + " " + .title,.body.storage.value'
29-
RESP_BODY_RESULTS='.results[]| .id + " " + .space.key + " " + .title + "\n" + .body.storage.value'
36+
RESP_SINGLE='.id + " [" + .space.key + "] \"" + .title + "\""'
37+
RESP_RESULTS='.results[]| .id + " [" + .space.key + "] \"" + .title + "\""'
38+
RESP_BODY_SINGLE='.id + " [" + .space.key + "] \"" + .title + "\"",.body.storage.value'
39+
RESP_BODY_RESULTS='.results[]| .id + " [" + .space.key + "] \"" + .title + "\"\n" + .body.storage.value'
3040

3141

32-
# Check
33-
if [ "${CONF_AUTH}" = "" ]; then
34-
echo -e "No PAT (personal access token) in environment defined!"
35-
exit 10
36-
fi

script/common/my.conf-tpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# Copy this file to ~/.restapi/my.conf
3+
# Add your personal configuration
4+
5+
CONF_BASE_URL_TEST=<confluence-url-test>
6+
CONF_BASE_URL_INTE=<confluence-url-integration>
7+
CONF_BASE_URL_PROD=<confuence-url-production>
8+
9+
CONF_PAT_TEST=<confluence-personal-access-token-test>
10+
CONF_PAT_INTE=<confluence-personal-access-token-integration>
11+
CONF_PAT_PROD=<confluence-personal-access-token-production>
12+
13+
MY_BASE_URL=${CONF_BASE_URL_TEST}
14+
MY_PAT=${CONF_PAT_TEST}

0 commit comments

Comments
 (0)