I have a future method that makes a callout to a .net application. Near the top I have the hard coded declaration:
private static final String SERVICE_URL = 'https://outside.site.com';
which I use later in a setEndpoint call on an HttpRequest object.
This string occurs in remote site settings - it has to, for it to work. The value of the string is different between the sandbox and production, but the name of the remote site setting object is the same - 'Broker'. I would like to eliminate this hard coded string and use the name 'Broker' to find the remote site setting object and set the endpoint to its URL - one less thing to worry about when moving between sandbox and production.
Although I see many examples of how to create a remote site setting using metadata or tooling, I have found no examples of how to query one, just dozens of other people asking how to do it.
What is the best, simplest way to eliminate this hard code?