Skip to content

Commit 7c4ef38

Browse files
WIP 9
Signed-off-by: Lukasz Gryglicki <[email protected]> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot)
1 parent 063b10a commit 7c4ef38

File tree

15 files changed

+51
-22
lines changed

15 files changed

+51
-22
lines changed

utils/shared/handle_api_url.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

utils/v3/docs/get_api_docs.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
# API_URL=http://localhost:5001 ./get_api_docs.sh
55
# API_URL=https://api.lfcla.dev.platform.linuxfoundation.org ./get_api_docs.sh
66

7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
79
# Handle API URL
8-
. ./utils/shared/handle_api_url.sh
10+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
911

1012
# Set up curl execution
1113
API="${API_URL}/v3/api-docs"

utils/v3/docs/get_swagger_json.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
# API_URL=http://localhost:5001 ./get_swagger_json.sh
55
# API_URL=https://api.lfcla.dev.platform.linuxfoundation.org ./get_swagger_json.sh
66

7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
79
# Handle API URL
8-
. ./utils/shared/handle_api_url.sh
10+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
911

1012
# Set up curl execution
1113
API="${API_URL}/v3/swagger.json"

utils/v3/health/get_health.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
# API_URL=http://localhost:5001 ./get_health.sh
55
# API_URL=https://api.lfcla.dev.platform.linuxfoundation.org ./get_health.sh
66

7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
79
# Handle API URL
8-
. ./utils/shared/handle_api_url.sh
10+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
911

1012
# Set up curl execution
1113
API="${API_URL}/v3/ops/health"

utils/v3/organization/search_organization.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ fi
2121
export companyName="$1"
2222
export websiteName="$2"
2323

24+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
25+
2426
# Handle API URL
25-
. ./utils/shared/handle_api_url.sh
27+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
2628

2729
# Build query parameters
2830
QUERY_PARAMS=""

utils/v3/shared/handle_api_url.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# Shared handler for API_URL environment variable for V3 APIs
3+
# Sets API_URL to remote dev server if REMOTE=1, otherwise defaults to localhost
4+
# Usage: . ./utils/v3/shared/handle_api_url.sh
5+
6+
if [ -z "$API_URL" ]
7+
then
8+
if [ "$REMOTE" = "1" ]
9+
then
10+
export API_URL="https://api.lfcla.dev.platform.linuxfoundation.org"
11+
else
12+
export API_URL="http://localhost:5001"
13+
fi
14+
fi

utils/v3/test_all_v3_apis.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
88

99
# Handle API URL
10-
. ./utils/shared/handle_api_url.sh
10+
. ${SCRIPT_DIR}/shared/handle_api_url.sh
1111

1212
# For authenticated endpoints (users API) - handle optionally
1313
if [ -z "$TOKEN" ]

utils/v3/users/create_user.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ export githubUsername="$6"
2121
export admin="${7:-false}"
2222
export note="${8:-Created via API script}"
2323

24+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
25+
2426
# Handle authentication
2527
. ./utils/shared/handle_auth.sh
2628

2729
# Handle API URL
28-
. ./utils/shared/handle_api_url.sh
30+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
2931

3032
# Build JSON payload
3133
PAYLOAD=$(cat <<EOF

utils/v3/users/delete_user.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ then
1414
fi
1515
export user_id="$1"
1616

17+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18+
1719
# Handle authentication
1820
. ./utils/shared/handle_auth.sh
1921

2022
# Handle API URL
21-
. ./utils/shared/handle_api_url.sh
23+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
2224

2325
# Set up curl execution
2426
API="${API_URL}/v3/users/${user_id}"

utils/v3/users/get_user.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ then
1414
fi
1515
export user_id="$1"
1616

17+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18+
1719
# Handle authentication
1820
. ./utils/shared/handle_auth.sh
1921

2022
# Handle API URL
21-
. ./utils/shared/handle_api_url.sh
23+
. ${SCRIPT_DIR}/../shared/handle_api_url.sh
2224

2325
# Set up curl execution
2426
API="${API_URL}/v3/users/${user_id}"

0 commit comments

Comments
 (0)