mirror of
https://github.com/muerwre/vk-tg-bot.git
synced 2025-05-08 21:26:40 +07:00
added templaters
This commit is contained in:
parent
1754092f7c
commit
d5228ef146
13 changed files with 406 additions and 17 deletions
src/config
|
@ -1,11 +1,14 @@
|
|||
import { TelegramConfig } from "../service/telegram/types";
|
||||
import { VkConfig } from "../service/vk/types";
|
||||
import { VkConfig, VkEvent } from "../service/vk/types";
|
||||
import { HttpConfig } from "../api/http/types";
|
||||
import { LoggerConfig } from "../service/logger/types";
|
||||
|
||||
export type TemplateConfig = Record<VkEvent, string>;
|
||||
|
||||
export interface Config extends Record<string, any> {
|
||||
http: HttpConfig;
|
||||
telegram: TelegramConfig;
|
||||
vk: VkConfig;
|
||||
logger?: LoggerConfig;
|
||||
templates?: TemplateConfig;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
import { boolean, object, string } from "yup";
|
||||
import { object, string } from "yup";
|
||||
import { httpConfigSchema } from "../api/http/validation";
|
||||
import { Config } from "./types";
|
||||
import { vkConfigSchema } from "../service/vk/validation";
|
||||
import { telegramConfigSchema } from "../service/telegram/validation";
|
||||
import { loggerConfigSchema } from "../service/logger/config";
|
||||
|
||||
const templateConfigSchema = object().shape({
|
||||
message_new: string().required(),
|
||||
});
|
||||
|
||||
const configSchema = object<Config>().required().shape({
|
||||
http: httpConfigSchema,
|
||||
vk: vkConfigSchema,
|
||||
telegram: telegramConfigSchema,
|
||||
logger: loggerConfigSchema,
|
||||
templates: templateConfigSchema,
|
||||
});
|
||||
|
||||
export const validateConfig = (config: Config) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue