
Guide to Environment Variables for RPACT Cloud
26 February, 2026 09:37:38
Source:vignettes/guide-to-environment-variables.Rmd
guide-to-environment-variables.RmdThis guide explains the configuration of required and optional
environment variables for the RPACT Cloud application. Environment
variables can be defined in an .Renviron file to ensure
they are correctly loaded when the application starts. They are
particularly useful for deployment in Posit Connect.
General Environment Variables
ENV
- Description: The current environment of the application.
- Usage: Allows distinguishing between different environments, such as development and production.
- Validation: Optional. If set, it is included in the email subject.
-
Example:
ENV=production
SESSION_TIMEOUT_SECONDS
- Description: The session timeout duration in seconds.
- Usage: Specifies how long a session can be idle before it is terminated.
- Validation: Must be a non-empty string containing only digits. The value is converted to an integer.
-
Example:
SESSION_TIMEOUT_SECONDS=3600
MODULE_LOG_MESSAGES_ENABLED
- Description: Indicates whether the log messages module is enabled.
- Usage: Enables or disables the log messages module.
- Validation: Must be a non-empty string with a value of either TRUE or FALSE.
-
Example:
MODULE_LOG_MESSAGES_ENABLED=TRUE
LOG_LEVEL
- Description: The logging level of the application.
- Usage: Specifies the level of detail for log messages.
-
Validation: Must be one of the following values:
trace,debug,info,warn,error,disabled. -
Example:
LOG_LEVEL=info
MAIL_VALIDATION_REGEX
- Description: A regular expression for validating email addresses.
- Usage: Used to validate the recipient email address.
- Validation: Must be a valid regular expression. If not set, a default regular expression is used.
-
Example:
MAIL_VALIDATION_REGEX=@example\.com$
MAIL_FROM
- Description: The sender’s email address.
- Usage: Specifies the email address from which emails are sent.
- Validation: Must be a valid email address.
-
Example:
MAIL_FROM=noreply@example.com
MAIL_REPLY_TO
- Description: The reply-to email address.
- Usage: Specifies the email address to which replies should be sent.
- Validation: Must be a valid email address.
-
Example:
MAIL_REPLY_TO=support@example.com
SMTP-Specific Environment Variables
The following variables configure the SMTP server and are optional. If no SMTP data is defined, all emails will be sent via the Mailgun account of RPACT using the Mailgun RESTful API.
MAIL_SMTP_USER
- Description: The user name for the SMTP server.
- Usage: Used to authenticate with the SMTP server.
- Validation: Must be a non-empty string.
-
Example:
MAIL_SMTP_USER=my_smtp_user
MAIL_SMTP_PASSWORD
- Description: The password for the SMTP server.
- Usage: Used to authenticate with the SMTP server.
- Validation: Must be a non-empty string.
-
Example:
MAIL_SMTP_PASSWORD=my_smtp_password
MAIL_SMTP_HOST
- Description: The host name of the SMTP server.
- Usage: Specifies the server to connect to for sending emails.
- Validation: Must be a non-empty string.
-
Example:
MAIL_SMTP_HOST=smtp.example.com
MAIL_SMTP_PORT
- Description: The port number for the SMTP server.
- Usage: Specifies the port to connect to on the SMTP server.
- Validation: Must be a non-empty string containing only digits. The value is converted to an integer.
-
Example:
MAIL_SMTP_PORT=587
MAIL_SMTP_SSL_ENABLED
- Description: Indicates whether SSL is enabled for the SMTP connection.
- Usage: Determines if SSL should be used when connecting to the SMTP server.
- Validation: Must be a non-empty string with a value of either TRUE or FALSE.
-
Example:
MAIL_SMTP_SSL_ENABLED=TRUE
Custom Help Link in the Sidebar
RPACT Cloud provides a configurable Help entry in the left sidebar navigation. This entry is rendered as a question-mark icon with a label (default: “Need help?”) and can be customized via environment variables to adapt the help behavior to different deployment contexts (e.g., internal documentation, external URLs, customer-specific portals).
Supported environment variables
The following environment variables control the appearance and behavior of the help link:
HELP_LINK_URL
Defines the target of the help link.HELP_LINK_LABEL
Defines the visible label shown next to the help icon in the sidebar.HELP_LINK_TITLE
Defines the tooltip text shown when hovering over the help link.
Default behavior (HELP_LINK_URL = "default")
If HELP_LINK_URL is set to "default"
(case-insensitive), the help link does not open an
external web page. Instead, clicking on the help icon opens an
internal help tab within the RPACT Cloud
application.
This default help tab provides an introduction to rpact and its core functionality. This default setting is intended to provide immediate, self-contained guidance for users without requiring access to external documentation.
External help links
If HELP_LINK_URL is set to any value other than
"default" or "tab", the help entry becomes an
external link:
- The link is opened in a new browser tab
(
target = "_blank"). - The label and tooltip are taken from
HELP_LINK_LABELandHELP_LINK_TITLE.
This mechanism allows deployments of RPACT Cloud to integrate customer-specific documentation, support portals, or internal knowledge bases.
How to Define Environment Variables in Posit Connect Workbench
Click on Varibles in the top right corner of the Posit Connect Workbench:

Click in Add variable:

Specify Name and Value and click Save:

A reminder will be shown that you need to restart the application to apply the changes:

You can edit existing variables by clicking on the Edit button:

Change the value and click Save:

Finally click on Republish to apply the changes:

Publishing from the Command Line
You can also publish the application from the command line using the
rsconnect. The environment variables can be set following
these instructions: Environment
variables