[READ-ONLY] Mirror of https://github.com/FoxxMD/tautulli-notification-digest. Consolidate Tautuilli Notification agent events for discord
digest discord newsletter notification plex tautulli tautulli-api webhook
0

Configure Feed

Select the types of activity you want to include in your feed.

Add basic ENV support

FoxxMD (Aug 14, 2023, 3:17 PM EDT) 7d1d5d6c 8464514b

+52 -1
+52 -1
src/common/config/ConfigBuilder.ts
··· 5 5 import {ErrorWithCause} from "pony-cause"; 6 6 import {parseFromYamlToObject} from "./ConfigUtil.js"; 7 7 import {SimpleError} from "../../utils/Errors.js"; 8 - import {OperatorConfig, OperatorJsonConfig, YamlOperatorConfigDocument} from "../infrastructure/OperatorConfig.js"; 8 + import { 9 + DigestData, 10 + OperatorConfig, 11 + OperatorJsonConfig, 12 + YamlOperatorConfigDocument 13 + } from "../infrastructure/OperatorConfig.js"; 9 14 import {Document as YamlDocument} from "yaml"; 10 15 import {createAjvFactory} from "../../utils/validation.js"; 11 16 import {Schema} from "ajv"; ··· 113 118 const { 114 119 defaults, 115 120 } = mergedConfig; 121 + 122 + 123 + const envWebhook = process.env.DISCORD_WEBHOOK; 124 + const envCron = process.env.CRON; 125 + const envEmbedType = process.env.FORMAT; 126 + 127 + if (envWebhook !== undefined && envCron !== undefined && mergedConfig.digests.length === 0) { 128 + const digest: DigestData = { 129 + slug: '', 130 + cron: envCron, 131 + discord: { 132 + webhook: envWebhook 133 + } 134 + } 135 + if (envEmbedType !== undefined) { 136 + if (envEmbedType.toLowerCase() === 'poster') { 137 + digest.discord.options = { 138 + poster: 0, 139 + thumbnail: false, 140 + list: false, 141 + text: false 142 + }; 143 + } else if (envEmbedType.toLowerCase() === 'thumbnail') { 144 + digest.discord.options = { 145 + poster: false, 146 + thumbnail: 0, 147 + list: false, 148 + text: false 149 + }; 150 + } else if (envEmbedType.toLowerCase() === 'text') { 151 + digest.discord.options = { 152 + poster: false, 153 + thumbnail: false, 154 + list: false, 155 + text: 0 156 + }; 157 + } else if (envEmbedType.toLowerCase() === 'list') { 158 + digest.discord.options = { 159 + poster: false, 160 + thumbnail: false, 161 + list: 0, 162 + text: false 163 + }; 164 + } 165 + } 166 + } 116 167 117 168 if (defaults !== undefined) { 118 169 for (const digest of mergedConfig.digests) {