Database
First, you need to set the connection config:
$config['db.host'] = 'localhost'; $config['db.name'] = 's-company-project'; $config['db.user'] = 'stage'; $config['db.prefix'] = 'tbl_'; $secret['db.pass'] = ['type' => 'str'];
As the password is stored via the secret helper, run either of these:
./cli --secret=check ./cli --install
You can get access to the database object though the helper function:
$db = db_get();
Alternative connections
If you need to connect to a different database, use the configuration:
$config['db.old.host'] = 'localhost'; $config['db.old.name'] = 's-company-project'; $config['db.old.user'] = 'stage'; $secret['db.old.pass'] = ['type' => 'str'];
Then access the database object via:
$db_old = db_get('old');