From 5a7eecdd56120bc29b47ab071c8b8cd16efa3843 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 30 Apr 2020 08:46:40 +0200 Subject: Add config helper for plugins --- server/lib/plugins/plugin-helpers.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'server/lib/plugins') diff --git a/server/lib/plugins/plugin-helpers.ts b/server/lib/plugins/plugin-helpers.ts index e91beffba..608207e05 100644 --- a/server/lib/plugins/plugin-helpers.ts +++ b/server/lib/plugins/plugin-helpers.ts @@ -2,6 +2,7 @@ import { PeerTubeHelpers } from '@server/typings/plugins' import { sequelizeTypescript } from '@server/initializers/database' import { buildLogger } from '@server/helpers/logger' import { VideoModel } from '@server/models/video/video' +import { WEBSERVER } from '@server/initializers/constants' function buildPluginHelpers (npmName: string): PeerTubeHelpers { const logger = buildPluginLogger(npmName) @@ -9,10 +10,13 @@ function buildPluginHelpers (npmName: string): PeerTubeHelpers { const database = buildDatabaseHelpers() const videos = buildVideosHelpers() + const config = buildConfigHelpers() + return { logger, database, - videos + videos, + config } } @@ -43,3 +47,11 @@ function buildVideosHelpers () { } } } + +function buildConfigHelpers () { + return { + getWebserverUrl () { + return WEBSERVER.URL + } + } +} -- cgit v1.2.3