用户管理 SMTP 和双因素认证环境变量#
基于文件的配置
您可以在单个变量后添加 _FILE 以在单独的文件中提供其配置。有关更多详细信息,请参阅在单独文件中保存敏感数据。
有关设置用户管理和电子邮件的更多信息,请参考用户管理。
| 变量 | 类型 | 默认值 | 描述 |
|---|---|---|---|
N8N_EMAIL_MODE |
String | smtp |
Enable emails. 启用邮件。 |
N8N_SMTP_HOST |
String | - | your_SMTP_server_name 你的 SMTP 服务器名称 |
N8N_SMTP_PORT |
Number | - | your_SMTP_server_port 你的 SMTP 服务器端口 |
N8N_SMTP_USER |
String | - | your_SMTP_username 你的 SMTP 用户名 |
N8N_SMTP_PASS |
String | - | your_SMTP_password 你的 SMTP 密码 |
N8N_SMTP_OAUTH_SERVICE_CLIENT |
String | - | If using 2LO with a service account this is your client ID 如果使用服务账户的 2LO,这是你的客户端 ID |
N8N_SMTP_OAUTH_PRIVATE_KEY |
String | - | If using 2LO with a service account this is your private key 如果使用服务账户的 2LO,这是你的私钥 |
N8N_SMTP_SENDER |
String | - | Sender email address. You can optionally include the sender name. Example with name: N8N <[email protected]> 发件人电子邮件地址。你可以选择包含发件人名称。带名称的示例:N8N <[email protected]> |
N8N_SMTP_SSL |
Boolean | true |
Whether to use SSL for SMTP (true) or not (false). 是否对 SMTP 使用 SSL(true)或不使用(false)。 |
N8N_SMTP_STARTTLS |
Boolean | true |
Whether to use STARTTLS for SMTP (true) or not (false). 是否对 SMTP 使用 STARTTLS(true)或不使用(false)。 |
N8N_UM_EMAIL_TEMPLATES_INVITE |
String | - | Full path to your HTML email template. This overrides the default template for invite emails. HTML 电子邮件模板的完整路径。这会覆盖邀请电子邮件的默认模板。 |
N8N_UM_EMAIL_TEMPLATES_PWRESET |
String | - | Full path to your HTML email template. This overrides the default template for password reset emails. HTML 电子邮件模板的完整路径。这会覆盖密码重置电子邮件的默认模板。 |
N8N_UM_EMAIL_TEMPLATES_WORKFLOW_SHARED |
String | - | Overrides the default HTML template for notifying users that a workflow was shared. Provide the full path to the template. 覆盖用于通知用户工作流已共享的默认 HTML 模板。提供模板的完整路径。 |
N8N_UM_EMAIL_TEMPLATES_CREDENTIALS_SHARED |
String | - | Overrides the default HTML template for notifying users that a credential was shared. Provide the full path to the template. 覆盖用于通知用户凭据已共享的默认 HTML 模板。提供模板的完整路径。 |
N8N_UM_EMAIL_TEMPLATES_PROJECT_SHARED |
String | - | Overrides the default HTML template for notifying users that a project was shared. Provide the full path to the template. 覆盖用于通知用户项目已共享的默认 HTML 模板。提供模板的完整路径。 |
N8N_USER_MANAGEMENT_JWT_SECRET |
String | - | Set a specific JWT secret. By default, n8n generates one on start. 设置特定的 JWT 密钥。默认情况下,n8n 在启动时生成一个。 |
N8N_USER_MANAGEMENT_JWT_DURATION_HOURS |
Number | 168 | Set an expiration date for the JWTs in hours. 设置 JWT 的过期时间(以小时为单位)。 |
N8N_USER_MANAGEMENT_JWT_REFRESH_TIMEOUT_HOURS |
Number | 0 | How many hours before the JWT expires to automatically refresh it. 0 means 25% of N8N_USER_MANAGEMENT_JWT_DURATION_HOURS. -1 means it will never refresh, which forces users to log in again after the period defined in N8N_USER_MANAGEMENT_JWT_DURATION_HOURS. JWT 过期前多少小时自动刷新它。0 表示 N8N_USER_MANAGEMENT_JWT_DURATION_HOURS 的 25%。-1 表示它永远不会刷新,这迫使用户在 N8N_USER_MANAGEMENT_JWT_DURATION_HOURS 中定义的期限后再次登录。 |
N8N_MFA_ENABLED |
Boolean | true |
Whether to enable two-factor authentication (true) or disable (false). n8n ignores this if existing users have 2FA enabled. 是否启用双因素认证(true)或禁用(false)。如果现有用户已启用 2FA,n8n 会忽略此设置。 |
N8N_INVITE_LINKS_EMAIL_ONLY |
Boolean | false |
When set to true, n8n will only deliver invite links via email and will not expose them through the API. This option enhances security by preventing invite URLs from being accessible programmatically, or to high privileged users. 设置为 true 时,n8n 将仅通过电子邮件传递邀请链接,不会通过 API 公开它们。此选项通过防止邀请 URL 以编程方式访问或访问高权限用户来增强安全性。 |