ToolJet/docs/versioned_docs/version-3.0.0-LTS/security/constants/constants.md
Pratik Agrawal 1ba4a2ed88
[docs]: Platform Revamp (#11585)
* Initial Structure Setup

* Add SMTP Configuration Content

* Add ToolJet Plan Content

* Update ToolJet Plan Docs

* Update SMȚP Configuration

* Add Organization Overview

* Update SMTP Cofig

* add licensing structure

* revert AppCard.jsx

* revert AppCard.jsx

* Revert AppMenu.jsx

* Revert Folders.jsx

* Revert ManageGroupPermissionResources.jsx

* revert mixins.scss

* revert tabler.scss

* revert tabler.scss

* revert tabler.scss

* revert tabler.scss

* add: white label doc

* Update overview

* add: instances and workspaces

* revert AppCard.jsx

* revert changes from EditVersionModal.jsx

* Revert Changes

* Delete Extra File

* fix: comments

* update interlink

* fix: multiple instance content

* tj deployment beta

* update tj deployment beta

* Update Email Server Beta

* Update Overview

* update setup email communication

* Update Licensing

* Update overview and self hosted docs

* Update self hosted beta

* Update Licensing

* minor improvments

* update link

* Update folder name

* minor updates

* Update Self Hosted

* Update Cloud and Overview

* Minor Updates and add Mailgun Screenshot

* Change beta folder structure and add sendgrid screenshot

* update setup tj folder

* Replicate changes to 3.0.0-LTS

* Add overview and onboard user structure in beta

* Add Overview for User Management and Access Control

* Add Invite User

* first draft - bulk invite, archive, self signup

* update: intance-workspace-whitelabelling

* fix: workspace-whitelable doc

* minor update in invite user

* Update Onboarding and Offboarding of Users - 03/01

* Add structure for authentication and rbac in beta

* update super admin file structure

* add super admin content

* Update overview page

* Overview for onboard and offboard user

* minor edit overview page

* Update Invite User

* Update Bulk Invite User

* updated archive user

* Update onboarding and offboarding

* Content Update

* Update Super Admin Structure

* Update Super Admin

* User Roles Content

* Custom Groups Content

* Granular Access Control [WIP]

* Add SSO Structure

* github sson 1

* github sso

* Google SSO

* ldap

* grammatical improvement

* Feedback Updates 1

* complete RBAC

* sso update

* SSO LDAP SAML OIDC

* OIDC Setup

* Google OIDC

* Update LDAP and SAML Intro

* Update Profile Management Structure

* Update Access Control Docs

* Update Custom Groups

* feat: authentication

* OIDC - Okta

* feat: cloud auth

* fix: overview typo

* fix: selfhosted auth titles

* Group Sync Structure

* User Metadata

* [WIP] OIDC Group Sync

* OIDC Group Sync

* Update use case example in user metadata

* Remove password management section

* Update reset password

* add: retry limit in password login

* Docs feedback update

* OIDC Group Sync Docs

* oidc grp sync

* Custom Group

* access control

* Profile Management Structure

* edit user details and reset password

* profile settings

* Development Lifecycle Structure

* [WIP] Version Control

* [WIP] Rollback

* Update GitSync Structure

* WIP GitSync

* Copy GitSync from the Develop

* Update version control as per feedback

* wip: release

* release and rollback

* GitSync

* GitSync

* feat: self-hosted and cloud

* gitsync backup docs

* [WIP] GitSync

* GitSync Backup

* share app ideation

* Share Application

* WIP Audit Logs

* WIP Okta SAML

* wip - okta saml

* Okta SAML

* Audit Logs

* Git Push and Pull

* GitSync Backup

* Release Management

* GitSync Config

* gitsync custom branch

* Workspace Constants

* Workspace Variables

* Update License

* update: images and css classes

* update: images

* update: envs

* update: images

* Img Update till Invite User

* update: removed cloud from Dev Life cycle

* feat: custom domain

* fix: formatting - custom domain

* update: workspace doc

* metadata img update

* Images till Onboard and Offboard

* SSO Images

* Image Update GitSync

* fix: naming

* delete sql backup

* update: images

* Add ToolJet API

* Enhance Nav Bar

* Update development lifecycle overview

* update: images

* Nav Bar Update

* fix: feedback

* Update FAQ dropdown

* feedback update

* Content Update

* fix: images

* fix: platform overview image

* Update Grammar and Links till Onboard Users

* Fix links

* Update Self Singup Screenshot

* Fix interlinking

* Fix GitSync Interlinks

* update: interlinking

* Delete Old Docs Beta

* Delete Old Files from LTS

* Replicate Files in LTS

* Update Home Page

* fix workspace login link

* fix links

* Deploy ToolJet

---------

Co-authored-by: PriteshKiri <pritesh.d.kiri@gmail.com>
2025-03-06 16:12:09 +05:30

7.8 KiB

id title
constants Workspace Constants

ToolJet allows you to set workspace constants to store pre-defined values that can be used across your application to maintain consistency, facilitate easy updates, and securely store sensitive information. Workspace constants are specific to the workspace where they are created and cannot be accessed in other workspaces. To enhance security, all constants and secrets are encrypted before being stored in the database, providing an additional layer of protection for sensitive data.

There are two types of constants:

  1. Global Constants: These are predefined values that can be used across your applications within a workspace. They allow you to store frequently used values, such as API URLs, configuration settings, etc. and access them within the workspace. Global Constants are resolved on the client side.
  2. Secret Constants: These are a specific type of workspace constants designed for securely storing sensitive information like API keys and database credentials. Secrets are masked and stored in encrypted format to prevent exposure to unauthorized users. Secret Constants are resolved on the server side, preventing exposure to the client.
    Note: Secret Constants cannot be used in RunJS or RunPy queries.

Characteristics and Usage

Characteristic Global Constants Secrets
Components
Data Queries *
Data Sources
Workflows Coming Soon
Encrypted in DB
Masked in Frontend
Resolved on Client Side
Resolved on Server Side
Naming Convention {{constants.constant_name}} {{secrets.secret_name}}

*Note:

  1. Secret Constants cannot be used in RunJS or RunPy queries.
  2. Secret Constants can only be used as a singular key and can't be used in a composite key manner.

Environment Specific Configurations

ToolJet allows users to define environment-specific configurations by assigning different values to constants and secrets across various environments. This approach is essential for managing sensitive information, such as API keys, database credentials, and external service endpoints, which may differ between development, staging, and production environments.

For example, you can configure unique API keys for each environment to ensure seamless integration and security.

Environment-Specific Constants

Creating Workspace Constants

Workspace constants/variables permissions is needed to Create, Update or Delete workspace constants, refer to Access Control guide for more information. After having the required permission, follow these steps to create a workspace constant:

  1. Navigate to the Workspace Constants tab from the left sidebar in ToolJet dashboard.
    (Example URL - https://app.corp.com/nexus/workspace-constants) Environment-Specific Constants

  2. Click on Create new constant button to open the configuration drawer. Create New Constant

  3. Enter a name and value for the workspace constant.

  4. Select the type of workspace constant:

    • Global constant
    • Secret
  5. Click the Add constant button to save.

:::info Once a constant or secret is created, its type cannot be changed. You'll need to delete it and create a new one of the desired type. :::

Accessing Workspace Constants

Global Constants

Global constants can be accessed using the syntax {{constants.constant_name}} can be used in the app builder, data sources, data queries, and workflows.

In App Builder

Inside the App Builder, you can find all the constants inside the inspector element on the left sidebar.

Use Global Constants Inside App Builder

In Data Sources and Queries

Global constants in ToolJet allow you to define values once and reuse them across your data sources and queries.

  • Data Source Connection Form: Use Global Constants Data Source Connection Form

  • Inside Queries in Query Manager: Use Global Constants Inside Queries in Query Manager

Using Secrets

Secrets are designed for secure storage of sensitive information like API keys, database credentials, and can be access using the syntax {{secrets.secret_name}}.

In Data Sources and Queries

In Data Sources and Queries, secret values are masked in the frontend and can only be viewed in the Workspace Constants dashboard.

  • Data Source Connection Form: Use Secrets in Data Source Connection Form

  • Inside Queries in Query Manager: Use Secrets Inside Queries in Query Manager

Mapping Workspace Constants from Environment Variables

From version v3.5.8-ee-lts, you can use environment variables to set global and secret constants. Workspace constants set using environment variables will have a .env tag in front of them. If there are two constants with the same name, the one set through the environment variable will be used in the app builder, while the constant set through the UI will have a duplicate tag in front of it.

Users cannot edit or delete constants created from environment variables through the UI. To add, update, or delete any values from an environment variable, the container must be restarted.

Mapping Workspace Constants from Environment Variables

Setting Global Constants

Setting Individual Global Constant

Syntax - TOOLJET_GLOBAL_CONSTANTS__<environment>__constant_name

Example - TOOLJET_GLOBAL_CONSTANTS__development__companyName = "Corp Pvt. Ltd."

Setting Multiple Global Constants

Syntax - TOOLJET_GLOBAL_CONSTANTS__<environment> = {“name1”: “value1", “name2”: “value2"}

Example - TOOLJET_GLOBAL_CONSTANTS__development = {"company1": "corp.com", "company2": "example.com"}

Setting Secret Constants

Setting Individual Global Constant

Syntax - TOOLJET_SECRET_CONSTANTS__<environment>__constant_name

Example - TOOLJET_SECRET_CONSTANTS__development__apiKey = "agdagdagdg"

Setting Multiple Global Constants

Syntax - TOOLJET_SECRET_CONSTANTS__<environment> = {“name1”: “value1", “name2”: “value2"}

Example - TOOLJET_SECRET_CONSTANTS__development = {"api_url": "https://api.example.com", "password" : "12345", "key" : "agdagdagdg"}