api working
This commit is contained in:
0
app/test/runner.sh → app/test/runner
Normal file → Executable file
0
app/test/runner.sh → app/test/runner
Normal file → Executable file
26
app/test/test.sh → app/test/test
Normal file → Executable file
26
app/test/test.sh → app/test/test
Normal file → Executable file
@@ -5,7 +5,7 @@
|
||||
|
||||
# ========= CONFIG =========
|
||||
API_KEY="your-secret-api-key"
|
||||
BASE_URL="http://localhost:8888"
|
||||
BASE_URL="https://dev.local"
|
||||
CONTAINER_ID="123e4567-e89b-12d3-a456-426614174000" # sample UUID
|
||||
# ==========================
|
||||
|
||||
@@ -16,7 +16,7 @@ root_redirect() {
|
||||
}
|
||||
|
||||
update_container() {
|
||||
curl -X POST "$BASE_URL/container/update" \
|
||||
curl -k -X POST "$BASE_URL/container/update" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Key: $API_KEY" \
|
||||
-d '{
|
||||
@@ -29,71 +29,71 @@ update_container() {
|
||||
}
|
||||
|
||||
start_container() {
|
||||
curl -X POST "$BASE_URL/container/start" \
|
||||
curl -k -X POST "$BASE_URL/container/start" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Key: $API_KEY" \
|
||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||
}
|
||||
|
||||
stop_container() {
|
||||
curl -X POST "$BASE_URL/container/stop" \
|
||||
curl -k -X POST "$BASE_URL/container/stop" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Key: $API_KEY" \
|
||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||
}
|
||||
|
||||
nuke_container() {
|
||||
curl -X POST "$BASE_URL/container/nuke" \
|
||||
curl -k -X POST "$BASE_URL/container/nuke" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Key: $API_KEY" \
|
||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||
}
|
||||
|
||||
info_all() {
|
||||
curl -X POST "$BASE_URL/container/info" \
|
||||
curl -k -X POST "$BASE_URL/container/info" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Key: $API_KEY" \
|
||||
-d '{}'
|
||||
}
|
||||
|
||||
info_one() {
|
||||
curl -X POST "$BASE_URL/container/info" \
|
||||
curl -k -X POST "$BASE_URL/container/info" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Key: $API_KEY" \
|
||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||
}
|
||||
|
||||
bump_container() {
|
||||
curl -X POST "$BASE_URL/container/bump" \
|
||||
curl -k -X POST "$BASE_URL/container/bump" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Key: $API_KEY" \
|
||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||
}
|
||||
|
||||
container_quota() {
|
||||
curl -X POST "$BASE_URL/container/quota" \
|
||||
curl -k -X POST "$BASE_URL/container/quota" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Key: $API_KEY" \
|
||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||
}
|
||||
|
||||
system_containers() {
|
||||
curl -X GET "$BASE_URL/system/containers" \
|
||||
curl -k -X GET "$BASE_URL/system/containers" \
|
||||
-H "X-API-Key: $API_KEY"
|
||||
}
|
||||
|
||||
system_images() {
|
||||
curl -X GET "$BASE_URL/system/images" \
|
||||
curl -k -X GET "$BASE_URL/system/images" \
|
||||
-H "X-API-Key: $API_KEY"
|
||||
}
|
||||
|
||||
system_info() {
|
||||
curl -X GET "$BASE_URL/system/info" \
|
||||
curl -k -X GET "$BASE_URL/system/info" \
|
||||
-H "X-API-Key: $API_KEY"
|
||||
}
|
||||
|
||||
system_pull() {
|
||||
curl -X POST "$BASE_URL/system/pull" \
|
||||
curl -k -X POST "$BASE_URL/system/pull" \
|
||||
-H "X-API-Key: $API_KEY"
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ prsync -h "$hosts_file" -avz ./sbin/ /4server/sbin/
|
||||
template templates/4server /etc/4server
|
||||
|
||||
#INSTALL API SERVICE
|
||||
template templates/init.d/4server-api /etc/init.d/4server-api:
|
||||
template templates/init.d/4server-api /etc/init.d/4server-api
|
||||
rex doas chmod 0755 /etc/init.d/4server-api
|
||||
rex doas chown root:root /etc/init.d/4server-api
|
||||
rex doas rc-update add 4server-api default
|
||||
|
||||
Reference in New Issue
Block a user