function drush_acsf_get_factory_creds in Acquia Cloud Site Factory Connector 8
Command callback. Prints factory information.
File
- ./
acsf.drush.inc, line 242 - Provides drush commands for site related operations.
Code
function drush_acsf_get_factory_creds() {
if (!class_exists('\\Drupal\\acsf\\AcsfConfigDefault')) {
// Since there might not be a bootstrap, we need to find our config objects.
$include_path = realpath(dirname(__FILE__));
require_once $include_path . '/src/AcsfConfig.php';
require_once $include_path . '/src/AcsfConfigDefault.php';
require_once $include_path . '/src/AcsfConfigIncompleteException.php';
require_once $include_path . '/src/AcsfConfigMissingCredsException.php';
}
try {
$config = new AcsfConfigDefault();
} catch (\Exception $e) {
drush_set_error('Failed to get config: ' . $e
->getMessage());
exit(1);
}
$creds = [
'url' => $config
->getUrl(),
'username' => $config
->getUsername(),
'password' => $config
->getPassword(),
'url_suffix' => $config
->getUrlSuffix(),
];
$output = drush_format($creds, NULL, 'json');
if (drush_get_context('DRUSH_PIPE')) {
drush_print_pipe($output);
}
else {
drush_print($output);
}
}