Domain and URL variables
For configuration, like an API server URL, I'd suggest using Drupal variables. There are several ways to set the variable:


In the settings.php:


$conf['api_server'] = 'http://example.com';



With Drush:


drush vset api_server 'http://example.com'


Build an admin screen where you can set the value. (Probably overkill in this case.)


In your code where you need the URL, use variable_get():

$url = variable_get('api_server');


To access the value in JavaScript see: How to pass PHP variables to Javascript/jQuery?