mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-20 16:12:10 +02:00
add google gecode API key support. Config variable: $config[geoloc][api_key] = "place_your_key_here"
This commit is contained in:
@@ -430,13 +430,13 @@ function location_to_latlng($device) {
|
||||
switch ($config['geoloc']['engine']) {
|
||||
case "google":
|
||||
default:
|
||||
d_echo("Google geocode engine being used\n");
|
||||
if (!empty($api_key = ($config['geoloc']['api_key']))) {
|
||||
d_echo("Use Google API key: $api_key\n");
|
||||
$api_url = "https://maps.googleapis.com/maps/api/geocode/json?address=$new_device_location&key=$api_key";
|
||||
} else {
|
||||
$api_url = "https://maps.googleapis.com/maps/api/geocode/json?address=$new_device_location";
|
||||
}
|
||||
d_echo("Google geocode engine being used\n");
|
||||
if (!empty($api_key = ($config['geoloc']['api_key']))) {
|
||||
d_echo("Use Google API key: $api_key\n");
|
||||
$api_url = "https://maps.googleapis.com/maps/api/geocode/json?address=$new_device_location&key=$api_key";
|
||||
} else {
|
||||
$api_url = "https://maps.googleapis.com/maps/api/geocode/json?address=$new_device_location";
|
||||
}
|
||||
break;
|
||||
}
|
||||
$curl_init = curl_init($api_url);
|
||||
|
||||
Reference in New Issue
Block a user