-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the problem to be solved
For the livechat plugin, I need to make API Calls from a XMPP server running on the Peertube server, to the Peertube instance.
For now, I use the public Peertube url to make these requests.
But this has 2 drawbacks:
- requests go through nginx, but they could bypass nginx to directly hit Peertube, as it is on the same server (and use http instead of https for better perf)
- in Docker installations, this can be a problem (the public url is not correctly resolved)
To fix the second point, I added a settings to change the API endpoint url, and you can for example set http://127.0.0.1:9000
I want to make this simpler, and I'd like to automatically compute this endpoint.
But for now, plugin manager provide no way to get the local host and port (the values listen.hostname and listen.port in the config file).
Describe the solution you would like
I'd like to have listen.host and listen.port somewhere in the helpers provided by Peertube.
For example, by adding it in the result of the backend getServerConfig helper.
Or by adding a new helper here:
PeerTube/server/lib/plugins/plugin-helpers-builder.ts
Lines 206 to 216 in 77239b4
| function buildConfigHelpers () { | |
| return { | |
| getWebserverUrl () { | |
| return WEBSERVER.URL | |
| }, | |
| getServerConfig () { | |
| return ServerConfigManager.Instance.getServerConfig() | |
| } | |
| } | |
| } |
function buildConfigHelpers () {
return {
getWebserverUrl () {
return WEBSERVER.URL
},
getServerListeningOptions {
return { hostname: WEBSERVER.HOSTNAME, port: WEBSERVER.PORT }
},
getServerConfig () {
return ServerConfigManager.Instance.getServerConfig()
}
}
}