To place this directory:
Create the following directory:
/mnt/gfs/[sitename].[env]/nobackupCreate any required subdirectories in the nobackup directory for organizing your files, such as the following:
/mnt/gfs/mysite.dev/nobackup/apikeys/mnt/gfs/mysite.test/nobackup/apikeys/mnt/gfs/mysite.prod/nobackup/apikeysBecause the system does not copy the nobackup directory between environments, you must create and populate the nobackup directory and its credential files separately on each environment.
You can now use the nobackup directory and any of its subdirectories to store your private files.
If you are storing required credentials in the nobackup directory, you can use Acquia-provided environmental variables to retrieve those credentials for your application. To enable this functionality:
In your nobackup directory or one of its subdirectories, create a PHP file. The PHP file can have any name, including the following example:
/mnt/gfs/$AH_SITE_GROUP.$AH_SITE_ENVIRONMENT/nobackup/apikeys/mysite_apikeys.phpEdit the PHP file and add one or more environmental variables, similar to the following:
putenv('MY_API_KEY_NAME=[key_value]');Edit your application's settings.php file and add code similar to the following to dynamically build the path to the credentials file and include it:
$env = $_ENV['AH_SITE_ENVIRONMENT'];
$site_group = $_ENV['AH_SITE_GROUP'];
$key_file = "/mnt/gfs/{$site_group}.{$env}/nobackup/apikeys/mysite_apikeys.php";
if (file_exists($key_file)) {
require $key_file;
}Create settings variables for Drupal's use by adding the following lines to your settings.php file:
| Drupal version | Code |
|---|---|
| Drupal 7 | |
| Current Drupal version | |
settings.php file.As a belt-and-braces approach, consider naming your credential files with an environment suffix. This ensures that each environment loads only its own credentials even in the unlikely event that files are synchronized between environments
Recommended naming conventions:
apikeys.prodapikeys.devsearchstax.prod.jsonsearchstax.dev.jsonThe full path pattern using environment variables is:
/mnt/gfs/$AH_SITE_GROUP.$AH_SITE_ENVIRONMENT/nobackup/apikeys.$AH_SITE_ENVIRONMENTAdd the following code to your settings.php to dynamically load the correct credential file for the current environment:
$env = $_ENV['AH_SITE_ENVIRONMENT'];
$site_group = $_ENV['AH_SITE_GROUP'];
$key_file = "/mnt/gfs/{$site_group}.{$env}/nobackup/apikeys.{$env}";
if (file_exists($key_file)) {
require $key_file;
}The AH_SITE_ENVIRONMENT environment variable contains the current environment name, such as prod, dev, or test
For documentation on the AH_SITE_GROUP and AH_SITE_ENVIRONMENT environment variables, refer to Using environment variables
If this content did not answer your questions, try searching or contacting our support team for further assistance.
To place this directory:
Create the following directory:
/mnt/gfs/[sitename].[env]/nobackupCreate any required subdirectories in the nobackup directory for organizing your files, such as the following:
/mnt/gfs/mysite.dev/nobackup/apikeys/mnt/gfs/mysite.test/nobackup/apikeys/mnt/gfs/mysite.prod/nobackup/apikeysBecause the system does not copy the nobackup directory between environments, you must create and populate the nobackup directory and its credential files separately on each environment.
You can now use the nobackup directory and any of its subdirectories to store your private files.
If you are storing required credentials in the nobackup directory, you can use Acquia-provided environmental variables to retrieve those credentials for your application. To enable this functionality:
In your nobackup directory or one of its subdirectories, create a PHP file. The PHP file can have any name, including the following example:
/mnt/gfs/$AH_SITE_GROUP.$AH_SITE_ENVIRONMENT/nobackup/apikeys/mysite_apikeys.phpEdit the PHP file and add one or more environmental variables, similar to the following:
putenv('MY_API_KEY_NAME=[key_value]');Edit your application's settings.php file and add code similar to the following to dynamically build the path to the credentials file and include it:
$env = $_ENV['AH_SITE_ENVIRONMENT'];
$site_group = $_ENV['AH_SITE_GROUP'];
$key_file = "/mnt/gfs/{$site_group}.{$env}/nobackup/apikeys/mysite_apikeys.php";
if (file_exists($key_file)) {
require $key_file;
}Create settings variables for Drupal's use by adding the following lines to your settings.php file:
| Drupal version | Code |
|---|---|
| Drupal 7 | |
| Current Drupal version | |
settings.php file.As a belt-and-braces approach, consider naming your credential files with an environment suffix. This ensures that each environment loads only its own credentials even in the unlikely event that files are synchronized between environments
Recommended naming conventions:
apikeys.prodapikeys.devsearchstax.prod.jsonsearchstax.dev.jsonThe full path pattern using environment variables is:
/mnt/gfs/$AH_SITE_GROUP.$AH_SITE_ENVIRONMENT/nobackup/apikeys.$AH_SITE_ENVIRONMENTAdd the following code to your settings.php to dynamically load the correct credential file for the current environment:
$env = $_ENV['AH_SITE_ENVIRONMENT'];
$site_group = $_ENV['AH_SITE_GROUP'];
$key_file = "/mnt/gfs/{$site_group}.{$env}/nobackup/apikeys.{$env}";
if (file_exists($key_file)) {
require $key_file;
}The AH_SITE_ENVIRONMENT environment variable contains the current environment name, such as prod, dev, or test
For documentation on the AH_SITE_GROUP and AH_SITE_ENVIRONMENT environment variables, refer to Using environment variables
If this content did not answer your questions, try searching or contacting our support team for further assistance.