mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 18:27:36 +00:00
feat: review comments
This commit is contained in:
@@ -1,89 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Configuration
|
|
||||||
BEARER_TOKEN="your-token-here"
|
|
||||||
BASE_URL="https://api.example.com"
|
|
||||||
|
|
||||||
# Colors for output
|
|
||||||
GREEN='\033[0;32m'
|
|
||||||
BLUE='\033[0;34m'
|
|
||||||
RED='\033[0;31m'
|
|
||||||
NC='\033[0m' # No Color
|
|
||||||
|
|
||||||
echo "Starting API requests with timing metrics..."
|
|
||||||
echo "=========================================="
|
|
||||||
|
|
||||||
# Request 1: POST with body
|
|
||||||
echo -e "\n${BLUE}1. POST Request${NC}"
|
|
||||||
echo "URL: $BASE_URL/endpoint1"
|
|
||||||
start_time=$(date +%s.%3N)
|
|
||||||
response1=$(curl -s -w "%{http_code}|%{time_total}" \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: Bearer $BEARER_TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{
|
|
||||||
"key1": "value1",
|
|
||||||
"key2": "value2"
|
|
||||||
}' \
|
|
||||||
"$BASE_URL/endpoint1")
|
|
||||||
end_time=$(date +%s.%3N)
|
|
||||||
|
|
||||||
http_code1=$(echo "$response1" | tail -c 10 | cut -d'|' -f1)
|
|
||||||
curl_time1=$(echo "$response1" | tail -c 10 | cut -d'|' -f2)
|
|
||||||
duration1=$(echo "$end_time - $start_time" | bc)
|
|
||||||
|
|
||||||
echo "Status Code: $http_code1"
|
|
||||||
echo "Duration: ${duration1}s (curl time: ${curl_time1}s)"
|
|
||||||
echo -e "${GREEN}✓ POST request completed${NC}"
|
|
||||||
|
|
||||||
# Request 2: GET with query params
|
|
||||||
echo -e "\n${BLUE}2. GET Request with Query Parameters${NC}"
|
|
||||||
echo "URL: $BASE_URL/endpoint2?param1=value1¶m2=value2"
|
|
||||||
start_time=$(date +%s.%3N)
|
|
||||||
response2=$(curl -s -w "%{http_code}|%{time_total}" \
|
|
||||||
-X GET \
|
|
||||||
-H "Authorization: Bearer $BEARER_TOKEN" \
|
|
||||||
"$BASE_URL/endpoint2?param1=value1¶m2=value2")
|
|
||||||
end_time=$(date +%s.%3N)
|
|
||||||
|
|
||||||
http_code2=$(echo "$response2" | tail -c 10 | cut -d'|' -f1)
|
|
||||||
curl_time2=$(echo "$response2" | tail -c 10 | cut -d'|' -f2)
|
|
||||||
duration2=$(echo "$end_time - $start_time" | bc)
|
|
||||||
|
|
||||||
echo "Status Code: $http_code2"
|
|
||||||
echo "Duration: ${duration2}s (curl time: ${curl_time2}s)"
|
|
||||||
echo -e "${GREEN}✓ GET request completed${NC}"
|
|
||||||
|
|
||||||
# Request 3: DELETE with body
|
|
||||||
echo -e "\n${BLUE}3. DELETE Request with Body${NC}"
|
|
||||||
echo "URL: $BASE_URL/endpoint3"
|
|
||||||
start_time=$(date +%s.%3N)
|
|
||||||
response3=$(curl -s -w "%{http_code}|%{time_total}" \
|
|
||||||
-X DELETE \
|
|
||||||
-H "Authorization: Bearer $BEARER_TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{
|
|
||||||
"id": "123",
|
|
||||||
"reason": "cleanup"
|
|
||||||
}' \
|
|
||||||
"$BASE_URL/endpoint3")
|
|
||||||
end_time=$(date +%s.%3N)
|
|
||||||
|
|
||||||
http_code3=$(echo "$response3" | tail -c 10 | cut -d'|' -f1)
|
|
||||||
curl_time3=$(echo "$response3" | tail -c 10 | cut -d'|' -f2)
|
|
||||||
duration3=$(echo "$end_time - $start_time" | bc)
|
|
||||||
|
|
||||||
echo "Status Code: $http_code3"
|
|
||||||
echo "Duration: ${duration3}s (curl time: ${curl_time3}s)"
|
|
||||||
echo -e "${GREEN}✓ DELETE request completed${NC}"
|
|
||||||
|
|
||||||
# Summary
|
|
||||||
echo -e "\n=========================================="
|
|
||||||
echo -e "${BLUE}SUMMARY${NC}"
|
|
||||||
echo "=========================================="
|
|
||||||
echo "Request 1 (POST): ${duration1}s"
|
|
||||||
echo "Request 2 (GET): ${duration2}s"
|
|
||||||
echo "Request 3 (DELETE): ${duration3}s"
|
|
||||||
total_time=$(echo "$duration1 + $duration2 + $duration3" | bc)
|
|
||||||
echo "Total Time: ${total_time}s"
|
|
||||||
echo -e "${GREEN}All requests completed successfully!${NC}"
|
|
||||||
@@ -8,6 +8,7 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
t.text("key").primary();
|
t.text("key").primary();
|
||||||
t.bigint("integerValue");
|
t.bigint("integerValue");
|
||||||
t.datetime("expiresAt");
|
t.datetime("expiresAt");
|
||||||
|
t.timestamps(true, true, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ import { TImmutableDBKeys } from "./models";
|
|||||||
export const KeyValueStoreSchema = z.object({
|
export const KeyValueStoreSchema = z.object({
|
||||||
key: z.string(),
|
key: z.string(),
|
||||||
integerValue: z.coerce.number().nullable().optional(),
|
integerValue: z.coerce.number().nullable().optional(),
|
||||||
expiresAt: z.date().nullable().optional()
|
expiresAt: z.date().nullable().optional(),
|
||||||
|
createdAt: z.date(),
|
||||||
|
updatedAt: z.date()
|
||||||
});
|
});
|
||||||
|
|
||||||
export type TKeyValueStore = z.infer<typeof KeyValueStoreSchema>;
|
export type TKeyValueStore = z.infer<typeof KeyValueStoreSchema>;
|
||||||
|
|||||||
Reference in New Issue
Block a user