Using Go Agent - Running your instrumented application for testing
Deployment types
Standalone
When deploying the application, the Sealights agent, which was embedded in the application via static instrumentation, will run when enabled.
Lambda
When deploying to lambda, the performance and network communication are critical. Therefore the scan should be done with light-mode set to true, and the lambda agent should communicate through the Sealights collector rather than directly to the Sealights servers by setting the collector-url.
See Using Go Agent - Scanning a build for more information regarding the
light-modeandcollector-urlSee Sealights HTTPS Collector for more information on the collector
Enabling the agent
If during the scan, the flag --disable-on-init true was provided, then the agent will be off by default. This is the recommended way to work as it prevents the agent from being accidentally in an environment not meant to have the agent running in.
To enable the agent, you need to provide the env variable
SEALIGHTS_DISABLE_ON_INITset to falseIf the
--disable-on-initwas not provided or set to false, then the agent will start working automatically with your application. To disable it, you can provide the env variableSEALIGHTS_DISABLEset to true
Providing a lab ID
To associate the application to a lab that the tests run against, the Lab ID needs to be provided via the dedicated environment variable SEALIGHTS_LAB_ID
For example, you can use the following commands:
Dockerfile | ENV SEALIGHTS_LAB_ID=integ_test_myapp |
Linux | export SEALIGHTS_LAB_ID=integ_test_myapp |
Powershell | $env:SEALIGHTS_LAB_ID='integ_test_myapp' |
Additional Environment variables
The go agent sets the runtime configuration during the scan process. However, in some cases, there is a need to override the configuration parameters during runtime. This can be done via environment variables as below:
Environment Variable Name | Default Value | Description |
|---|---|---|
|
| You need to set this env variable to |
|
| If you do not run the scan with |
| ““ | Setting Collector URL in light mode (for Lambda apps) |
| BuildSession Id | Setting the Lab ID |
| ““ | One or several comma-separated tags (no spaces) to label the agent execution in the cockpit, e.g., |
| ““ | Proxy URL for connection to the Sealights server |
|
| Min log level: “ |
|
| Enable/Disable agent mode in light mode (for Lambda apps) |