librenms-librenms/config_to_json.php
Tony Murray abc6a5b799 PSR-2 Final cleanup (#4247)
refactor: Final PSR2 cleanup
2016-08-28 23:32:55 +01:00

30 lines
557 B
PHP

<?php
/*
* Configuration to JSON converter
* Written by Job Snijders <job@instituut.net>
*
*/
$defaults_file = 'includes/defaults.inc.php';
$config_file = 'config.php';
// move to install dir
chdir(dirname($argv[0]));
function iscli()
{
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
return true;
} else {
return false;
}
}
// check if we are running through the CLI, otherwise abort
if (iscli()) {
include_once $defaults_file;
include_once $config_file;
print (json_encode($config));
}