drupal-console
drupal-console copied to clipboard
[console] - Site alias not passing the uri
Problem/Motivation
When I run a drupal command for my docksal local env, I have to set the uri in the drupal command even though I have configured a site alias for drupal console for my local dev environment.
Error
Warning: array_merge(): Argument #1 is not an array in phar:///usr/local/bin/drupal/vendor/drupal/console-core/src/Utils/ConfigurationManager.php on line 156
Drupal Console version 1.8.0
[ERROR] The specified database connection is not defined: default
Version info
- Drupal version: 8.5.4
- Console version: 1.8.0
- Console Launcher version: 1.0.2
- Docksal version: 1.60.2
Configuration info
My site alias yml file:
dev:
root: /var/www/docroot
user: user
options:
uri: 'http://site.docksal'
type: container
My drush alias file:
$aliases['dev'] = array(
'uri' => 'http://site.docksal',
'root' => '/var/www/docroot',
'path-aliases' => array(
'%files' => 'sites/default/files',
'%dump-dir' => '/var/www/db',
),
'databases' =>
array (
'default' =>
array (
'default' =>
array (
'database' => 'default', // local database
'username' => 'user', // local database user
'password' => 'user', // local database pw
'host' => 'db',
'port' => '',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
'prefix' => '',
),
),
),
);
My settings.php file:
$httphost = $_SERVER['HTTP_HOST'];
switch (true) {
case isset($httphost) && substr_count($httphost, 'lovin.docksal') > 0: //dev local
$settings['container_yamls'][] = $app_root . '/' . $site_path . '/local.services.yml';
$databases['default']['default'] = array (
'database' => 'default',
'username' => 'user',
'password' => 'user',
'prefix' => '',
'host' => 'db',
'port' => '',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
include $app_root . '/' . $site_path . '/settings.local.php';
}
break;
...
}
Steps to reproduce:
Run: fin @project drush @dev exec drupal @site.dev --version
Workaround
Pass the URI in the command: fin @project drush @dev exec drupal @site.dev --uri=http://site.docksal --version
@jmolivas asked that I submit this, per discussion on drupal-console channel on drupal slack workspace
@tekNorah Did you find a workaround for this?
@wizonesolutions - The workaround was to pass in the URI
Workaround Pass the URI in the command: fin @project drush @dev exec drupal @site.dev --uri=http://site.docksal --version