Remove DB credentials from config.php

Better validation when config.php does not exist

Update docs and quote password

only populate legacy vars in config_to_json
drop .travis.yml config copy
remove credentials from config.php.default

Check for existance of .env instead of config.php in python scripts

legacy credential cleanup

tiny cleanups

consistent env for artisan server and artisan dusk
This commit is contained in:
Tony Murray
2019-05-22 13:31:24 -05:00
parent b9bd2b3d08
commit 5f0388f0e3
20 changed files with 67 additions and 211 deletions

View File

@@ -107,7 +107,7 @@ class Database extends BaseValidation
private function checkMysqlEngine(Validator $validator)
{
$db = Config::get('db_name', 'librenms');
$db = \config('database.connections.'.\config('database.default').'.database');
$query = "SELECT `TABLE_NAME` FROM information_schema.tables WHERE `TABLE_SCHEMA` = '$db' && `ENGINE` != 'InnoDB'";
$tables = dbFetchRows($query);
if (!empty($tables)) {

View File

@@ -44,13 +44,12 @@ class User extends BaseValidation
{
// Check we are running this as the root user
$username = $validator->getUsername();
$lnms_username = Config::get('user');
$lnms_username = Config::get('user', 'librenms');
$lnms_groupname = Config::get('group', $lnms_username); // if group isn't set, fall back to user
if (!($username === 'root' || $username === $lnms_username)) {
if (isCli()) {
$validator->fail('You need to run this script as root' .
(Config::has('user') ? ' or ' . $lnms_username : ''));
$validator->fail("You need to run this script as $lnms_username or root");
} elseif (function_exists('posix_getgrnam')) {
$lnms_group = posix_getgrnam($lnms_groupname);
if (!in_array($username, $lnms_group['members'])) {
@@ -73,7 +72,7 @@ class User extends BaseValidation
}
// Let's test the user configured if we have it
if (Config::has('user')) {
if ($lnms_username) {
$dir = Config::get('install_dir');
$log_dir = Config::get('log_dir', "$dir/logs");
$rrd_dir = Config::get('rrd_dir', "$dir/rrd");