We would like to avoid to hardcode values in an apex class and use "environment variable". Is the use of custom settings the right way to do that?
Today I created a custom settings containing two fields, an url and an authorization token. The values are different from one sandbox to another, so I create one data set for each of my sandboxes (dev-int-uat-prod). Now my problem is to know in which sandbox I am? To retrieve the right values from my custom setting and of course I don't want to hardcode it. I used
UserInfo.getUserName().substringAfterLast('@').substringAfterLast('.')
to retrieve the sandbox name but for production this code doesn't work, so can anyone help me on the best way to do that?
Thanks in advance for your answers and your help.