Advanced settings

Configure variables

You can store multiple secret variables for each piece of published content. Secret variables are encrypted and ideal for sensitive information. To add a new variable at the time of publish:

  1. Click + Add variable
  2. Enter a name for your secret variable
  3. Enter a value for your secret variable

Variables will be stored when you press Publish. These variables are encrypted and stored securely on Connect Cloud. They can be used during the deployment by a given application or document.

Calling variables in source

Imagine you want to deploy an application that uses the API from OpenAI. Your application would need to send an API Key to OpenAI and it is a best practice not to store such credentials in your source code.

This is why storing encrypted secrets on Connect Cloud is helpful. For example:

  • name: OPENAI_API_KEY
  • value: sk-2O0XuO23VHIydJd1ul0LHeL6U7G41wk2F84rB7LdJ50sQ9TF

You can then reference the variable in your code.

import os
api_key = os.getenv('OPENAI_API_KEY') 

api_key <- Sys.getenv("OPENAI_API_KEY")