1 Star 4 Fork 32

HuangWanddy/tooljet

forked from Gitee 极速下载/tooljet 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
workspace-environment-variables.md 2.48 KB
一键复制 编辑 原始数据 按行查看 历史
idtitle
workspace-environment-variablesWorkspace Variables

Workspace Variables are the variables with some value(usually tokens/secret keys/API keys) that can be used in different apps across the same Workspace.

How can we add these variables to an Workspace?

Suppose there is an API key or a value that you want to use in the queries or widgets in the multiple apps of the same Workspace then the Workspace admin or the user with permissions can add an environment variable.

Adding the environment variable

  • Go to the ToolJet Dashboard, and click on the dropdown on the navigation bar to show Workspace options
  • Select Manage Environment Variables
  • Click on Add New Variable button
  • Give a Name to the variable, set the value, choose Type, toggle Encryption, and click Add Variable button
  • Now this variable can be used inside any application of this Workspace
add variable

Types of variables

  • Client: The client variable can be used in widgets and queries.

  • Server: The server variables can be used with all the queries except the RunJS. The reason why we don't allow the server variables to be used with the widgets is that these variables are only resolved during the runtime so they're highly secured.

:::info Variable Type cannot be changed once it has been created. :::

variable-type

Encryption

This feature enables us to add a client variable with and without encryption. The server variables are always encrypted by default.

Using variable in an app

Let's use the variable that we created here. If you have used ToolJet before, then you know that for getting the values from any variable we use JS notation i.e. {{}} but for using the Workspace variables we have different opening and closing notation %% %%. The environment variables will not work inside js code {{}}.

So, the syntax for using the variable that we created before will be %%client.pi%%

Example for client variable usage:

variable-usage

Example for server variable usage:

server-variable-usage
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/wanddyh/tooljet.git
git@gitee.com:wanddyh/tooljet.git
wanddyh
tooljet
tooljet
develop

搜索帮助