Rocket.Chat allows you to manage workspace settings using environment variables, offering an efficient alternative to modifying settings directly through the admin UI or database. This guide will provide a comprehensive overview of how you can manage settings using environmental variables and the data types for each kind of setting.
To manage a setting using an environment variable, you need its setting ID. You can find the ID by hovering over the setting label in your workspace’s administration panel.
Configuring settings with environment variables
With environment variables in Rocket.Chat, you can:
Set the initial value for a setting
To define the value of a setting for the first time when starting the server, add the environment variable SETTING_ID=VALUE
.
For example:
FileUpload_Storage_Type=hiGoogleCloudStorage
This only applies if the setting hasn't been previously configured in the UI or database. If the setting already has a value, use overwrite setting.
Overwrite the setting value
You can overwrite the value of any setting by using an environment variable prefixed with OVERWRITE_SETTING_<Setting Id>
.
For example:
OVERWRITE_SETTING_FileUpload_Storage_Type=GoogleCloudStorage
Settings capable of this action can be seen when hovered in the Administration > Workspace > Settings section.
Block settings
To lock a setting and prevent it from being changed via the UI or API, use the SETTINGS_BLOCKED
variable with a comma-separated list of setting IDs you want to block. For example:
SETTINGS_BLOCKED=FileUpload_Storage_Type,FileUpload_GoogleStorage_AccessId,FileUpload_GoogleStorage_Secret
To unblock any setting, remove it from the list and restart your Rocket.chat server.
Hide settings
To hide sensitive settings from appearing in the workspace UI, use the SETTINGS_HIDDEN
variable with a comma-separated list of setting IDs you want to hide: For example:
SETTINGS_HIDDEN=FileUpload_GoogleStorage_AccessId,FileUpload_GoogleStorage_Secret
Use this command with extreme caution and avoid hiding any settings that the Rocket.Chat client depends on, for example
FileUpload_Storage_Type
.
Setting metadata and data types
To use environment variables effectively, it helps to understand the structure of each setting. Each setting includes metadata like its ID, type, default value, and visibility. When setting values via environment variables, you must use the correct data type—e.g., string, boolean, number, etc.
Basic settings
Name | Data Type |
---|---|
|
|
|
|
| boolean |
| boolean |
|
|
|
|
|
|
| string |
|
|
|
|
| boolean |
| string |
| string |
| number |
| unknown |
| boolean |
| boolean |
| boolean |
| Array |
|
|
| string |
| boolean |
| string |
| boolean |
|
|
|
|
| Date |
| Date |
| Date |
| boolean |
| Array |
| string |
|
|
| boolean |
| boolean |
| string |
| boolean |
Group settings
Name | Data Type |
---|---|
| string |
| boolean |
| boolean |
| Date |
| number |
| string |
| string |
| string |
| undefined |
| group |
| string |
Enterprise settings
Name | Data Type |
---|---|
| true |
|
|
Color settings
Name | Data Type |
---|---|
| color |
| SettingEditor |
| SettingEditor |
Action settings
Name | Data Type |
---|---|
| action |
| string |
| string |
Code settings
Name | Data Type |
---|---|
| action |
| string |
| string |
Asset settings
Name | Data Type |
---|---|
| asset |
| AssetValue |
| IRocketChatAssetConstraint |
| string |
SelectOption settings
Name | Data Type |
---|---|
| The type can be:
|
| string |
Editor settings
Name | Data Type |
---|---|
| color |
| expression |
Date settings
Name | Data Type |
---|---|
| Date |
| Date |
Statistics settings
Name | Data Type |
---|---|
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| string |
| string |
| string |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |
| boolean |