- Print
- DarkLight
- PDF
Manage Settings Using Environmental Variables
- Print
- DarkLight
- PDF
In software configuration, environmental variables play a crucial role in managing settings. Rocket.Chat leverages environmental variables to provide a flexible and efficient way to manage settings. This guide will provide a comprehensive overview of how Rocket.Chat manages settings using environmental variables
When starting your server, you can set any settings value via an environment variable. You will only have to know the setting ID and the data type of the setting (boolean, string, integer, 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 |
Settings actions
You can take the following actions while configuring your workspace settings:
Set the setting values for the first time.
Overwrite setting values.
Block settings from being changed.
Hide settings.
Set any wizard setting as mandatory.
Let's look at these options in detail.
Set setting
To set a setting for the first time, you need only to add the environment variable SETTING_ID=VALUE
when starting the server.
For example:
FileUpload_Storage_Type=hiGoogleCloudStorage
This only works if the setting isn't already set; hence it's most useful for setting on the initial start. If the setting already has a value, you will need to use overwrite setting.
Overwrite setting
You can overwrite any setting by setting an environment variable prefixed with OVERWRITE_SETTING_<Setting Id>
.
For example:
OVERWRITE_SETTING_FileUpload_Storage_Type=GoogleCloudStorage
Settings capable of this can be seen when hovered in the Administration > Workspace > Settings section.
Block settings
You can block a setting from being changed by specifying the SETTINGS_BLOCKED
environment variable. It is a comma-separated list. You need to add any setting you want to block to this list.
For example:
SETTINGS_BLOCKED=FileUpload_Storage_Type,FileUpload_GoogleStorage_AccessId,FileUpload_GoogleStorage_Secret
As an administrator, you can't change this from the UI. You must remove it from the list and reboot the server to change this setting.
Hide settings
You can hide settings from the client by using the SETTINGS_HIDDEN
environment variable.
For example:
SETTINGS_HIDDEN=FileUpload_GoogleStorage_AccessId,FileUpload_GoogleStorage_Secret
Take extra caution here because the client needs settings like
FileUpload_Storage_Type
, so it can not be hidden.
Required wizard settings
You can force settings to be required on wizard pages by using the SETTINGS_REQUIRED_ON_WIZARD
environment variable.
For example:
SETTINGS_REQUIRED_ON_WIZARD=Organization_Type,Organization_Name
Rocket.Chat's use of environmental variables for managing your workspace settings provides a powerful and flexible configuration mechanism.