Storing sensitive data securely in Acquia


Storing sensitive data securely in Acquia environment can be done simply by following below steps.
  • 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.
    sftp <username>@<host-name>
            (OR) 
    sftp <ssh-url>
  • 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.
    cd /mnt/files/dummy.dev/ put secrets.settings.php
  • Now your secrets.settings.php pushed to the server. Now you need to include the secrets.settings.php in settings.php as below:
    $secret_file = sprintf('/mnt/files/%s.%s/secrets.settings.php',
                   $_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:




Kindly Subsribe to Things to know -Mr Ko & Acquia Pantheon Drupal Blog.
To get latest updates and solutions for the errors you facing.