Question
Can I change the environment of an existing server by updating the agent configuration?
Answer
The server environment can be specified in the agent configuration to determine if the server should be marked as QA
, PRODUCTION
or DEVELOPMENT
in the Contrast UI:
- Yaml Path:
server.environment
- Environment Variable:
CONTRAST__SERVER__ENVIRONMENT
- System Property:
-Dcontrast.server.environment
(Java agent only)
The server environment specified in the agent configuration only takes effect when the server is first created. To change it, you can:
- As an Admin user, update it manually through the Contrast UI using the
Environment
dropdown on theServers
tab. -
As an Admin user, delete the server from the Contrast UI on the
Servers
tab using the trash icon that appears to the right when hovering over the server. Follow these steps:- Stop the application and ensure there's no agent traffic between the server and the Contrast UI. Note that the server will be recreated with the original environment type if an agent heartbeat or any traffic is received from it before you can restart the server with the updated configuration.
- Delete the server in the Contrast UI.
- Start the application with the updated environment config.
- The environment can also be updated by the agent if the automatic server cleanup job has ran to delete the server from the Contrast UI after it has been offline for a specified period (see Set server defaults at an organization level for more info). The environment sent by the agent in the new create server request will be honored.