mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 20:24:47 +00:00
filter union for smtp
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import { SmtpValue } from "../types"
|
||||
import { Config, TypeAsConfigOf } from "./builder/config"
|
||||
import { Config, ConfigSpecOf } from "./builder/config"
|
||||
import { Value } from "./builder/value"
|
||||
import { Variants } from "./builder/variants"
|
||||
|
||||
export const smtpConfig = Value.union(
|
||||
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 email",
|
||||
@@ -14,7 +17,7 @@ export const smtpConfig = Value.union(
|
||||
system: { name: "System Credentials", spec: Config.of({}) },
|
||||
custom: {
|
||||
name: "Custom Credentials",
|
||||
spec: Config.of<TypeAsConfigOf<SmtpValue>>({
|
||||
spec: Config.of<ConfigSpecOf<SmtpValue>>({
|
||||
server: Value.text({
|
||||
name: "SMTP Server",
|
||||
required: {
|
||||
|
||||
Reference in New Issue
Block a user