--- /usr/local/pkg/ntopng.inc.orig 2016-11-28 14:15:00.000000000 +0100
+++ /usr/local/pkg/ntopng.inc 2016-12-09 22:46:37.000000000 +0100
@@ -168,6 +161,9 @@
/* Set up admin password */
ntopng_set_redis_password();
+ /* Set up Google Maps API Key */
+ ntopng_set_googlemaps_apikey();
+
/* (Re)start services if not booting */
if (!platform_booting()) {
ntopng_services_stop();
@@ -222,6 +218,21 @@
}
}
+function ntopng_set_googlemaps_apikey() {
+ global $config, $ntopng_config, $redis_path;
+ $ntopng_config = $config['installedpackages']['ntopng']['config'][0];
+
+ if (!empty($ntopng_config['googlemaps_api_key'])) {
+ $apikey = $ntopng_config['googlemaps_api_key'];
+ if (ntopng_redis_started()) {
+ mwexec("{$redis_path}/redis-cli SET ntopng.prefs.google_apis_browser_key " . escapeshellarg($apikey));
+ mwexec("{$redis_path}/redis-cli save");
+ } else {
+ log_error(gettext("[ntopng] Cannot set Google Maps API Key - redis-server is not running."));
+ }
+ }
+}
+
function ntopng_create_datadir() {
safe_mkdir("/var/db/ntopng/rrd/graphics", 0755);
mwexec("/bin/chmod -R 755 /var/db/ntopng");
--- /usr/local/pkg/ntopng.xml.orig 2016-11-28 14:15:00.000000000 +0100
+++ /usr/local/pkg/ntopng.xml 2016-12-09 22:46:25.000000000 +0100
@@ -162,7 +149,7 @@
The historical interface is considered abandoned by upstream,
pending more usable replacement.
- WARNING: This will delete all ntopng graphs, traffic data and historical dump flows!
+ WARNING: This will delete all ntopng graphs, traffic data and historical dump flows!
]]>
checkbox
@@ -173,6 +160,19 @@
Disables all alerts generated by ntopng, such as flooding notifications.checkbox
+
+ Google Maps API Key
+ googlemaps_api_key
+
+
+ Detailed information on how to obtain an API key can be found here.
+ Once obtained, the API key can be placed in this field.
+ ]]>
+
+ input
+ 40
+
ntopng_sync_package();