_____/\\\\\\\\\\\____/\\\_________________/\\\\\\\\\\\___ ___/\\\/////////\\\_\/\\\_______________/\\\/////////\\\_ __\//\\\______\///__\/\\\______________\//\\\______\///__ ___\////\\\_________\/\\\_______________\////\\\_________ ______\////\\\______\/\\\__________________\////\\\______ _________\////\\\___\/\\\_____________________\////\\\___ __/\\\______\//\\\__\/\\\______________/\\\______\//\\\__ _\///\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\_\///\\\\\\\\\\\/___ ___\///////////_____\///////////////____\///////////_____ simple-license-server
A simple server for checking issued licenses with tokens
- Quick start
- Usage
- Configuration file
- Examples of Rest Requests
- Generating a new token
- Use with the pm2
- License
First, install the dependencies
npm i
Then write
node . -s
usage: node . [--help | -h] [--new-license | -nl <number in how many days to expire in days>]
[--start | -s]
{
"ip": "The IP address where you want to deploy the server",
"port": "port on which to deploy the server must be a number",
"licenseListPath": "Path to token/license file, path must be relative, e.g. \"./licenseList.json\", only .json files are supported",
"updateInterval": "The time to check if the licenses/tokens have expired should be a number in milliseconds, for example 1800000 (30 minutes)"
}
This example will use the axios module
axios.get('http://ip_on_where_the_server_is:port/ping')
.then(res => console.log(res.data))
//Expected output: OK
axios.post('http://ip_on_where_the_server_is:port/checkKey', {token: "токен сегенерированным сервером"})
.then(res => console.log(res.data))
//Expected output:
// {
// "checkStatus": true
// }
Example with token expiration in 10 days
node . -nl 10
The new token will be added to the license list file and will be displayed in the console
Expected output:
new token: 3afeuc5kkY99MAxd
npm i pm2@latest -g
pm2 start node . --name SLS --time -e ./logs/err.log -o ./logs/out.log -l ./logs/full.log -- -s
Description of the parameters used here:
--name
- set the name of the application in the list of processes--time
- logs will be with time-e, -o, -l
- set the location of the application logs, the logs will be located in /logs-- -s
- pass the -s parameter to the server startup script
- Let's add an autostart of processes after reboot
pm2 startup
- Save our list of processes
pm2 save
- Open monitoring panel:
pm2 monit
- Open process list:
pm2 list
- Open logs:
pm2 logs
.
Official Pm2 documentation https://pm2.keymetrics.io/docs/usage/quick-start/