This repository has been archived by the owner on Feb 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathMakefile
45 lines (40 loc) · 1.9 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
API_PORT := 8080
# This can be pointed at the localhost:8080 instance of the API as well
API_BASE_URL := https://leapfrogai-api.uds.dev
SUPABASE_BASE_URL := https://supabase-kong.uds.dev
EXPIRATION_TIME := $(shell date -d "+30 days" +%s)
SUPABASE_ANON_KEY := $(shell uds zarf tools kubectl get secret -n leapfrogai supabase-bootstrap-jwt -o json | uds zarf tools yq '.data.anon-key' | base64 -d)
install: set-env
python -m pip install ../../src/leapfrogai_sdk
python -m pip install -e ".[dev]"
set-env:
echo "SUPABASE_URL=${SUPABASE_BASE_URL}" > .env
echo "SUPABASE_ANON_KEY=${SUPABASE_ANON_KEY}" >> .env
dev: set-env
python -m uvicorn main:app --port ${API_PORT} --reload --log-level info --env-file .env
api-key:
curl -s -X POST '${SUPABASE_BASE_URL}/auth/v1/signup' \
-H "apikey: ${SUPABASE_ANON_KEY}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${SUPABASE_ANON_KEY}" \
-d '{ "email": "[email protected]", "password": "password", "confirmPassword": "password"}' | \
uds zarf tools yq '.access_token' | \
xargs -I {} curl -s --insecure -X POST '${API_BASE_URL}/leapfrogai/v1/auth/api-keys' \
-H "apikey: {}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {}" \
-d '{ "name": "api-key", "expires_at": "${EXPIRATION_TIME}" }' | \
uds zarf tools yq '.api_key'
new-api-key:
curl -s -X POST '${SUPABASE_BASE_URL}/auth/v1/token?grant_type=password' \
-H "apikey: ${SUPABASE_ANON_KEY}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${SUPABASE_ANON_KEY}" \
-d '{ "email": "[email protected]", "password": "password"}' | \
uds zarf tools yq '.access_token' | \
xargs -I {} curl -s --insecure -X POST '${API_BASE_URL}/leapfrogai/v1/auth/api-keys' \
-H "apikey: {}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {}" \
-d '{ "name": "api-key", "expires_at": "${EXPIRATION_TIME}" }' | \
uds zarf tools yq '.api_key'