mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-04-04 14:29:47 +00:00
better smtp const
This commit is contained in:
@@ -3,22 +3,7 @@ import { Config, ConfigSpecOf } from "./builder/config"
|
|||||||
import { Value } from "./builder/value"
|
import { Value } from "./builder/value"
|
||||||
import { Variants } from "./builder/variants"
|
import { Variants } from "./builder/variants"
|
||||||
|
|
||||||
export const smtpConfig = Value.filteredUnion(
|
export const customSmtp = Config.of<ConfigSpecOf<SmtpValue>, never, never>({
|
||||||
async ({ effects, utils }) => {
|
|
||||||
const smtp = await utils.getSystemSmtp().once()
|
|
||||||
return smtp ? [] : ["system"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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<ConfigSpecOf<SmtpValue>, never, never>({
|
|
||||||
server: Value.text({
|
server: Value.text({
|
||||||
name: "SMTP Server",
|
name: "SMTP Server",
|
||||||
required: {
|
required: {
|
||||||
@@ -56,7 +41,36 @@ export const smtpConfig = Value.filteredUnion(
|
|||||||
description:
|
description:
|
||||||
"Require TLS transport security. If disabled, email will use plaintext by default and TLS via STARTTLS <strong>if the SMTP server supports it</strong>. If enabled, email will refuse to connect unless the server supports STARTTLS.",
|
"Require TLS transport security. If disabled, email will use plaintext by default and TLS via STARTTLS <strong>if the SMTP server supports it</strong>. If enabled, email will refuse to connect unless the server supports STARTTLS.",
|
||||||
}),
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const smtpConfig = Value.filteredUnion(
|
||||||
|
async ({ effects, utils }) => {
|
||||||
|
const smtp = await utils.getSystemSmtp().once()
|
||||||
|
return smtp ? [] : ["system"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "SMTP",
|
||||||
|
description: "Optionally provide an SMTP server for sending emails",
|
||||||
|
required: { default: "disabled" },
|
||||||
|
},
|
||||||
|
Variants.of({
|
||||||
|
disabled: { name: "Disabled", spec: Config.of({}) },
|
||||||
|
system: {
|
||||||
|
name: "System Credentials",
|
||||||
|
spec: Config.of({
|
||||||
|
customFrom: Value.text({
|
||||||
|
name: "Custom From Address",
|
||||||
|
description:
|
||||||
|
"A custom from address for this service. If not provided, the system from address will be used.",
|
||||||
|
required: false,
|
||||||
|
placeholder: "<name>test@example.com",
|
||||||
|
inputmode: "email",
|
||||||
}),
|
}),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
name: "Custom Credentials",
|
||||||
|
spec: customSmtp,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user