Storing sensitive data securely in Acquia
- First you need ssh access to your acquia server.
- You need to create a file named 'secrets.settings.php', in which you need to store your sensitive information as given below,
const API_KEY = 'dummy_key';
- After including api key in secrets.settings.php, you need to push it to the acquia server. Using sftp you can push the file to your server.
(OR)
sftp <ssh-url>
$_ENV['AH_SITE_GROUP'],
$_ENV['AH_SITE_ENVIRONMENT']);
if(file_exists($secret_file)){ require $secret_file; }
- Using above command you will logged in to the server. Kindly, run sftp command from the place where your secrets.settings.php exists, so that you can put the file to the server easily.
- Now navigate to /mnt/files/<website-name>.<env-name>/ and put the 'secrets.settings.php' in the current directory.
- Now your secrets.settings.php pushed to the server. Now you need to include the secrets.settings.php in settings.php as below:
$_ENV['AH_SITE_GROUP'],
$_ENV['AH_SITE_ENVIRONMENT']);
if(file_exists($secret_file)){ require $secret_file; }
- After pushing the settings.php to your acquia environment, you can use the constant directly in your codebase.
- You refer the below video: