Downloading the Node.js agent file
Agent File
Our Node.js agents (slnodejs) are published in the npm registry. You download it and all its dependencies using the npm repository commands.
Downloading latest version
npm i slnodejsDownloading the recommended version by Sealights (Best Practice)
For Customers that need to set a specific recommended agent version other than the default latest, the API will provide the recommended agent version that has been set on the dedicated settings page from the dashboard.
In the following examples, replace $DOMAIN with your domain and $SL_TOKEN with your SeaLights agent token
Linux | # Fetch Agent version defined in Sealights dashboard settings
$SLVERSION=$(curl -X GET "https://$DOMAIN.sealights.co/api/v2/agents/slnodejs/recommended" -H "accept: application/json" -H "Authorization: Bearer $SL_TOKEN" -L)
# Install Sealights Agent (Recommended version)
npm i slnodejs@$SLVERSION |
PowerShell | # Fetch Agent version defined in Sealights dashboard settings
$SLVERSION = Invoke-RestMethod -Uri "https://$DOMAIN.sealights.co/api/v2/agents/slnodejs/recommended" -Headers @{ "accept" = "application/json", "Authorization" = "Bearer $SL_TOKEN"}
# Install Sealights Agent (Recommended version)
npm i "slnodejs@$SLVERSION" |
GitLab YML | before_script:
- apt-get -qq update && apt-get install -y jq
script:
- |
SLVERSION=$(curl -X GET "https://$DOMAIN.sealights.co/api/v2/agents/slnodejs/recommended" -H "accept: application/json" -H "Authorization: Bearer $SL_TOKEN" -L | jq -r .agent.version )
npm install slnodejs@$SLVERSION |