mirror of
https://github.com/muerwre/vk-tg-bot.git
synced 2025-04-25 15:06:41 +07:00
#4 added simple DB layer
This commit is contained in:
parent
f3a746efe8
commit
c0588acd26
15 changed files with 476 additions and 11 deletions
|
@ -2,6 +2,7 @@ import { TelegramConfig } from "../service/telegram/types";
|
|||
import { VkConfig, VkEvent } from "../service/vk/types";
|
||||
import { HttpConfig } from "../api/http/types";
|
||||
import { LoggerConfig } from "../service/logger/types";
|
||||
import { PostgresConfig } from "../service/db/postgres/types";
|
||||
|
||||
export type TemplateConfig = Record<VkEvent, string>;
|
||||
|
||||
|
@ -11,4 +12,5 @@ export interface Config extends Record<string, any> {
|
|||
vk: VkConfig;
|
||||
logger?: LoggerConfig;
|
||||
templates?: TemplateConfig;
|
||||
postgres?: PostgresConfig;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Config } from "./types";
|
|||
import { vkConfigSchema } from "../service/vk/validation";
|
||||
import { telegramConfigSchema } from "../service/telegram/validation";
|
||||
import { loggerConfigSchema } from "../service/logger/config";
|
||||
import { dbConfigValidatior } from "../service/db/postgres/validation";
|
||||
|
||||
const templateConfigSchema = object().shape({
|
||||
message_new: string().required(),
|
||||
|
@ -15,6 +16,7 @@ const configSchema = object<Config>().required().shape({
|
|||
telegram: telegramConfigSchema,
|
||||
logger: loggerConfigSchema,
|
||||
templates: templateConfigSchema,
|
||||
postgres: dbConfigValidatior,
|
||||
});
|
||||
|
||||
export const validateConfig = (config: Config) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue