From e88187683a00eceb6f3c27d16016b1b2287c0df0 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Mon, 1 May 2023 14:27:22 -0600 Subject: [PATCH] add smtp constant --- lib/config/constants.ts | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 lib/config/constants.ts diff --git a/lib/config/constants.ts b/lib/config/constants.ts new file mode 100644 index 0000000..963a7fa --- /dev/null +++ b/lib/config/constants.ts @@ -0,0 +1,55 @@ +import { Config, Value, Variants } from "./builder" + +export const smtpConfig = Value.union( + { + name: "SMTP", + description: "Optionally provide an SMTP server for sending email", + required: { default: "disabled" }, + }, + Variants.of({ + disabled: { name: "Disabled", spec: Config.of({}) }, + system: { name: "System Credentials", spec: Config.of({}) }, + custom: { + name: "Custom Credentials", + spec: Config.of({ + server: Value.text({ + name: "SMTP Server", + required: { + default: null, + }, + }), + port: Value.number({ + name: "Port", + required: { default: 587 }, + min: 1, + max: 65535, + integer: true, + }), + from: Value.text({ + name: "From Address", + required: { + default: null, + }, + placeholder: "test@example.com", + inputmode: "email", + }), + login: Value.text({ + name: "Login", + required: { + default: null, + }, + }), + password: Value.text({ + name: "Password", + required: false, + }), + tls: Value.toggle({ + name: "Require Transport Security", + default: true, + description: + "Require TLS transport security. If disabled, email will use plaintext by default and TLS via STARTTLS if the SMTP server supports it. If enabled, email will refuse to connect unless the server supports STARTTLS.", + }), + }), + }, + }), +)