From f8ca391cb2cb98cbdf2de9e725bf241e589f1d36 Mon Sep 17 00:00:00 2001 From: Andrey Egorov Date: Thu, 4 Dec 2025 10:10:40 +0300 Subject: [PATCH] feat: moved secretes --- .gitignore | 1 + req.sh | 50 ++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 46d34b8..f36cf8f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ tmp.token ready_params.json backups/ +.env diff --git a/req.sh b/req.sh index ec67fa7..579c6f8 100755 --- a/req.sh +++ b/req.sh @@ -1,15 +1,33 @@ -#ADDR=api-fema.ekatgortrans.ru:39080 -#ADDR=https://api.fema.krbl.ru -#ADDR=62.217.183.88:8080 -ADDR=0.0.0.0:8080/api/v1 -LOGIN=admin -PASSWORD=admin -#PASSWORD=IR7?BoouErjhXsxg -#PASSWORD=ra8KvcMxS2baUxe* -#MASTER_CODE=685658 -MASTER_CODE=111111 +CFG="LOCAL" +# CFG="POLYGON" +# CFG="KRBL" +# CFG="EKB" + MFA_OFF="YES" +source .env + +if [ $CFG == "LOCAL" ]; then + ADDR=$LOCAL_ADDR + LOGIN=$LOCAL_LOGIN + PASSWORD=$LOCAL_PASSWORD + MASTER_CODE=$LOCAL_MASTER_CODE +elif [ $CFG == "EKB" ]; then + ADDR=$EKB_ADDR + LOGIN=$EKB_LOGIN + PASSWORD=$EKB_PASSWORD + MASTER_CODE=$EKB_MASTER_CODE +elif [ $CFG == "KRBL" ]; then + ADDR=$KRBL_ADDR + LOGIN=$KRBL_LOGIN + PASSWORD=$KRBL_PASSWORD + MASTER_CODE=$KRBL_MASTER_CODE +elif [ $CFG == "POLYGON" ]; then + ADDR=$POLYGON_ADDR + LOGIN=$POLYGON_LOGIN + PASSWORD=$POLYGON_PASSWORD + MASTER_CODE=$POLYGON_MASTER_CODE +fi #set -x @@ -40,6 +58,10 @@ elif [[ $1 == "update-user" ]]; then curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \ -d "{\"username\": \"admin\", \"email\": \"yotia@unprism.ru\", \"full_name\": \"oaf\", \"is_admin\": true}" \ "$ADDR/auth/updateUser" +elif [[ $1 == "groups" ]]; then + curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" "$ADDR/transport/groups" +elif [[ $1 == "list-groups" ]]; then + curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" "$ADDR/transport/listAllGroups" elif [[ $1 == "users" ]]; then curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" "$ADDR/system/getUsers" elif [[ $1 == "devices" ]]; then @@ -79,8 +101,12 @@ elif [[ $1 == "get-from-redis" ]]; then "$ADDR/data/getDataFromRedis?fileID=$2" elif [[ $1 == "alarms-amount" ]]; then curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \ - -d '{ "devices": ["A56AF66F17D902B8"], "start_time": 1757890398, "end_time": 1757892398 }' \ + -d '{ "start_time": 1761226492158, "end_time": 1761140092158 }' \ "$ADDR/data/alarms/getAlarmsAmount" | jq +elif [[ $1 == "alarms-amount-per-device" ]]; then + curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \ + -d '{ "start_time": 0, "end_time": 0, "active": false }' \ + "$ADDR/data/alarms/getGroupAlarmsAmountPerDevice" | jq elif [[ $1 == "alarms" ]]; then curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \ -d "{ \"devices\": [\"A56AF66F17D902B8\"], \"start_time\": 1, \"end_time\": $(date +%s), \"order\": [[\"sensor_id\", \"+\"]], \"page_number\": 1, \"page_size\": 30}" \ @@ -124,7 +150,7 @@ elif [[ $1 == "transport-group-create" ]]; then "$ADDR/transport/createGroup" | jq elif [[ $1 == "sensor-data" ]]; then curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(cat tmp.token)" \ - -d "{ \"device\": \"2025082700003820\", \"sensor\": \"TEMPERATURE/PIIZI_TEMPERATURE_1\", \"start\": $(($(date +%s)-5000)), \"end\": $(date +%s), \"skip\": 1 }" \ + -d "{ \"device\": \"A56AF66F17D902B8\", \"sensor\": \"TEMPERATURE/85\", \"start\": $(($(date +%s)-5000)), \"end\": $(date +%s), \"skip\": 1 }" \ "$ADDR/data/sensors/getDeviceSensorData" | jq elif [[ $1 == "factory-models" ]]; then if [[ $2 == "" ]]; then