diff --git a/README.md b/README.md index 3ba0c316..257770f6 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,14 @@ Due to the security risk it's not recommended to ignore HTTPS errors. GF_RENDERER_PLUGIN_IGNORE_HTTPS_ERRORS=true ``` +**gRPC port:** + +Change the listening port of the gRPC server. Default is `0` and will automatically assign a port not in use. + +```bash +GF_RENDERER_PLUGIN_GRPC_PORT=50059 +``` + ## Remote Rendering Using Docker Instead of installing and running the image renderer as a plugin, you can run it as a remote image rendering service using Docker. Read more about [remote rendering using Docker](https://github.com/grafana/grafana-image-renderer/blob/master/docs/remote_rendering_using_docker.md). diff --git a/src/app.ts b/src/app.ts index 4623c75a..e995925f 100644 --- a/src/app.ts +++ b/src/app.ts @@ -73,6 +73,10 @@ function populatePluginConfigFromEnv(config: PluginConfig, env: NodeJS.ProcessEn config.rendering.timezone = env['TZ']; } + if (env['GF_RENDERER_PLUGIN_GRPC_PORT']) { + config.plugin.grpc.port = parseInt(env['GF_RENDERER_PLUGIN_GRPC_PORT'] as string, 10); + } + if (env['GF_RENDERER_PLUGIN_IGNORE_HTTPS_ERRORS']) { config.rendering.ignoresHttpsErrors = env['GF_RENDERER_PLUGIN_IGNORE_HTTPS_ERRORS'] === 'true'; } diff --git a/src/config.ts b/src/config.ts index be555259..c7c0f0c2 100644 --- a/src/config.ts +++ b/src/config.ts @@ -68,7 +68,7 @@ export const defaultPluginConfig: PluginConfig = { plugin: { grpc: { host: '127.0.0.1', - port: 50059, + port: 0, }, }, rendering: defaultRenderingConfig, diff --git a/src/plugin/grpc-plugin.ts b/src/plugin/grpc-plugin.ts index 90525c7b..68134807 100644 --- a/src/plugin/grpc-plugin.ts +++ b/src/plugin/grpc-plugin.ts @@ -55,6 +55,10 @@ export class GrpcPlugin { if (this.config.rendering.chromeBin) { this.log.info( 'Renderer plugin started', + 'grpcHost', + this.config.plugin.grpc.host, + 'grpcPort', + boundPortNumber, 'chromeBin', this.config.rendering.chromeBin, 'ignoreHTTPSErrors',