title: How to query remote site settings from Apex
body: <p>I have a future method that makes a <code>callout</code> to a <code>.net</code> application.  Near the top I have the hard coded declaration:</p>
  
  <pre><code>private static final String SERVICE_URL = 'https://outside.site.com';
  </code></pre>
  
  <p>which I use later in a <code>setEndpoint</code> call on an <code>HttpRequest</code> object.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>What is the best, simplest way to eliminate this hard code?</p>