Skip to main content

Secure Credentials

You can store your credentials as environment variables when using an On-premise Agent, enabling you to store secrets locally rather than in the Superblocks Cloud. Environment variables prefixed with SUPERBLOCKS_AGENT_APP_ENV_ can be referenced using the global Env object.

Environment Variable Prefix (SUPERBLOCKS_AGENT_APP_ENV_)

All environment variables that are prefixed with SUPERBLOCKS_AGENT_APP_ENV_ are accessible through the Env global variable. You can use them in Superblocks with the environment variable name without the prefix (e.g. Env.postgres_password). To use:

  1. Specify environment variables prefixed with SUPERBLOCKS_AGENT_APP_ENV_ (e.g. SUPERBLOCKS_AGENT_APP_ENV_POSTGRES_PASSWORD) in the environment in which the On-premise Agent is deployed
  2. Reference the environment variable insider Superblocks as a property on the global Env object by the suffix of the environment variable (e.g. {{Env.postgres_password}} for the example above)
info

The global {{Env}} variable can be accessed on the integration page or when defining API steps.

Example: Configuring a Postgres Integration with Environment Variable Secrets

  1. Expose the environment variables SUPERBLOCKS_AGENT_APP_ENV_POSTGRES_USERNAME and SUPERBLOCKS_AGENT_APP_ENV_POSTGRES_PASSWORD to your On-premise Agent
  2. Navigate to the Integrations tab in the menu bar on the left side of the Home page and select a Postgres integration
  3. Enable "Fetch credentials dynamically" via the toggle at the top of the Postgres integration form
  4. Enter the username and password as {{Env.postgres_username}} and {{Env.postgres_password}}.