We have an docker image that will be deployed to both non prod and prod. and we wanted to have different names for each environment. How can i achieve this in .Net core (tried adding config value in appsettting.nonprod.json “NewRelic.AppName”: “Test” which did not work) @ebeach
You can name your .NET apps using the newrelic.config or the NEW_RELIC_APP_NAME environment variable before running your application.
Because this is a docker image, I’d recommend making the change in your dockerfile so that different environments build images with different appnames. You can find an example dockerfile using the environment variable to set the name here:
Note that this environment variable needs to be set and picked up by your application at runtime.
Thanks for the reply.
We dont have different images for different environments, we build the image once and use it in multiple environments. How do i approach to have different names per environment in that scenario ? @beastman
You can set environment variables like the NEW_RELIC_APP_NAME at runtime with Docker using the -e flag:
docker run -e "NEW_RELIC_APP_NAME=someappnamehere"