Add config helper for plugins
This commit is contained in:
parent
ebefc902f5
commit
5a7eecdd56
2 changed files with 17 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,10 @@ export type PeerTubeHelpers = {
|
|||
videos: {
|
||||
removeVideo: (videoId: number) => Promise<void>
|
||||
}
|
||||
|
||||
config: {
|
||||
getWebserverUrl: () => string
|
||||
}
|
||||
}
|
||||
|
||||
export type RegisterServerOptions = {
|
||||
|
|
Loading…
Reference in a new issue