aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/plugins/plugin-helpers.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-30 08:46:40 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-04 16:21:39 +0200
commit5a7eecdd56120bc29b47ab071c8b8cd16efa3843 (patch)
tree5e7d5b4bf95abeccde12252d7927d3847c925569 /server/lib/plugins/plugin-helpers.ts
parentebefc902f59be6c5542c19ff706e310d9dddf75f (diff)
downloadPeerTube-5a7eecdd56120bc29b47ab071c8b8cd16efa3843.tar.gz
PeerTube-5a7eecdd56120bc29b47ab071c8b8cd16efa3843.tar.zst
PeerTube-5a7eecdd56120bc29b47ab071c8b8cd16efa3843.zip
Add config helper for plugins
Diffstat (limited to 'server/lib/plugins/plugin-helpers.ts')
-rw-r--r--server/lib/plugins/plugin-helpers.ts14
1 files changed, 13 insertions, 1 deletions
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'
2import { sequelizeTypescript } from '@server/initializers/database' 2import { sequelizeTypescript } from '@server/initializers/database'
3import { buildLogger } from '@server/helpers/logger' 3import { buildLogger } from '@server/helpers/logger'
4import { VideoModel } from '@server/models/video/video' 4import { VideoModel } from '@server/models/video/video'
5import { WEBSERVER } from '@server/initializers/constants'
5 6
6function buildPluginHelpers (npmName: string): PeerTubeHelpers { 7function buildPluginHelpers (npmName: string): PeerTubeHelpers {
7 const logger = buildPluginLogger(npmName) 8 const logger = buildPluginLogger(npmName)
@@ -9,10 +10,13 @@ function buildPluginHelpers (npmName: string): PeerTubeHelpers {
9 const database = buildDatabaseHelpers() 10 const database = buildDatabaseHelpers()
10 const videos = buildVideosHelpers() 11 const videos = buildVideosHelpers()
11 12
13 const config = buildConfigHelpers()
14
12 return { 15 return {
13 logger, 16 logger,
14 database, 17 database,
15 videos 18 videos,
19 config
16 } 20 }
17} 21}
18 22
@@ -43,3 +47,11 @@ function buildVideosHelpers () {
43 } 47 }
44 } 48 }
45} 49}
50
51function buildConfigHelpers () {
52 return {
53 getWebserverUrl () {
54 return WEBSERVER.URL
55 }
56 }
57}