Managing secrets
Use the Secrets page on the PageBuilder Editor Developer’s Tools to encrypt and decrypt secrets, which are confidential values based on your environment.
In the Secrets page, you can encrypt values using environment-specific keys, allowing you to store sensitive information safely in your code repository. When you deploy your application, PageBuilder automatically decrypts these values, making them available to your application without exposing the actual sensitive data.
Scenario: Encrypting an API key for the Production environment
As an administrator for a media organization, you need to integrate movie data from the OMDb API into your site’s PageBuilder Engine application. You want to configure your API key so it works locally and when deployed to Production, while keeping it secure from unauthorized access.
You access the environment configuration files to set up your API key locally, then use the Secrets encryption tool to secure the key for deployment. This process allows your API integration to work consistently across all environments while maintaining security best practices for your credentials.
Procedures
Encrypting environment secrets
Follow these steps to secure your environment variables for deployment in a specific environment; this example uses the Production environment:
-
Navigate to PageBuilder Editor > Developer Tools > Deployer > Secrets to open the Secrets’ encrypt and decrypt page.
-
Copy your API key value, for example,
your_api_key. -
Paste the value in the Encrypt > Text for encryption field.
-
Click Encrypt to generate an encrypted value.
The system populates the Encrypted secret text field with a value similar to:
AQICAHiyXqCUn+vJKIoKYSjgK94d75UA48M9ufKJTthOyTWrcQHqK5gtPws. -
Click Copy next to the Encrypted secret text field to copy the value to your clipboard.
-
Create or modify your environment file, such as
/environment/production.js, and paste the encrypted value, enclosing it between percentage signs:javascriptmodule.exports = {MY_API_KEY: "%YOUR_ENCRYPTED_VALUE%"}
Your API key is now securely configured for your Production environment.
Decrypting environment secrets
Follow these steps to verify credential values when troubleshooting authentication issues or migrating between environments:
-
Navigate to PageBuilder Editor > Developer Tools > Deployer > Secrets to open the Secrets’ encrypt and decrypt page.
-
Paste your encrypted value into the Decrypt > Secret to decrypt field.
-
Click Decrypt to retrieve the original value. The system displays the unencrypted value in the Decrypted text field, for example,
your_api_key.The system populates the Decrypted text field with the unencrypted value, such as
AQICAHiyXqCUn+vJKIoKYSjgK94d75UA48M9ufKJTthOyTWrcQHqK5gtPws. -
Click Copy next to the Decrypted text field to copy the value to your clipboard.