netmaker/test/nodecreate.sh

27 lines
564 B
Bash
Raw Normal View History

2021-03-26 00:17:52 +08:00
#!/bin/bash
PUBKEY="DM5qhLAE20EG9BbfBEger+Ac9D2NDOwCtY1rbYDLf34="
IPADDR="70.173.21.212"
MACADDRESS="59:23:9c:f2:e4:49"
2021-08-26 05:59:40 +08:00
ACCESSKEY="DYrXDkNuXC3XQ27J"
2021-03-26 00:17:52 +08:00
PASSWORD="ppppppp"
generate_post_json ()
{
cat <<EOF
{
"endpoint": "$IPADDR",
"publickey": "$PUBKEY",
"macaddress": "$MACADDRESS",
"password": "$PASSWORD",
2021-05-30 20:04:40 +08:00
"localaddress": "172.123.123.3",
"accesskey": "$ACCESSKEY"
2021-03-26 00:17:52 +08:00
}
EOF
}
POST_JSON=$(generate_post_json)
2021-07-26 23:08:25 +08:00
curl --max-time 5.0 -d "$POST_JSON" -H 'Content-Type: application/json' -H "authorization: Bearer secretkey" localhost:8081/api/nodes/skynet
2021-03-26 00:17:52 +08:00