Skip to content

Commit

Permalink
ACMS-3658: README file updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkhode1 committed Mar 22, 2024
1 parent 4b15e8b commit 71b246a
Showing 1 changed file with 4 additions and 58 deletions.
62 changes: 4 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,68 +30,14 @@ on when these events are triggered. You can find the examples of such
implementations from [here](examples).

# Quick examples
## Generate settings for a given site
### Generate settings with default credentials for the default site:
```
<?php
/**
* @file
* Include DRS settings.
*/
use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
use Acquia\Drupal\RecommendedSettings\Settings;
// Create settings object.
$siteUri = "site1";
$settings = new Settings(DRUPAL_ROOT, $siteUri);
try {
// Call generate method.
$settings->generate();
}
catch (SettingsException $e) {
echo $e->getMessage();
}
./vendor/bin/drush init:settings
```

## Generate settings for a given site passing database credentials

### Set up a new site with custom credentials for the local environment:
```
<?php
/**
* @file
* Include DRS settings.
*/
use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
use Acquia\Drupal\RecommendedSettings\Settings;
// Create settings object.
$siteUri = "site1";
$settings = new Settings(DRUPAL_ROOT, $siteUri);
// Database details.
$dbSpec = [
'drupal' => [
'db' => [
'database' => 'drupal', // In case of multi-site database name is replaced with the site name.
'username' => 'drupal',
'password' => 'drupal',
'host' => 'localhost',
'port' => '3306',
],
],
];
try {
// Call generate method passing database details.
$settings->generate($dbSpec);
}
catch (SettingsException $e) {
echo $e->getMessage();
}
./vendor/bin/drush init:settings --database=site1 --username=myuser --password=mypass --host=127.0.0.1 --port=1234 --uri=site1
```

# License
Expand Down

0 comments on commit 71b246a

Please sign in to comment.