13
0
geforkt von Mirrors/Paper

Add velocity forwarding secret env override (#10127)

Previously, the velocity forwarding secret could only be configured via
the configuration option in the global paper configuration.
This makes configuring/passing such a value rather difficult for
containerized/orchestrated servers as these configuration files are
usually part of the server data volume itself and hence cannot be
sourced from a secret.

This commit enables administrators to define the PAPER_VELOCITY_SECRET
environment variable, which will override any potentially configured
velocity secret.
Dieser Commit ist enthalten in:
Oliver Janka 2024-09-22 20:25:27 +02:00
Ursprung e371c168d8
Commit 36472a9173

Datei anzeigen

@ -594,7 +594,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @PostProcess
+ private void postProcess() {
+ if (this.enabled && this.secret.isEmpty()) {
+ if (!this.enabled) return;
+
+ final String environmentSourcedVelocitySecret = System.getenv("PAPER_VELOCITY_SECRET");
+ if (environmentSourcedVelocitySecret != null && !environmentSourcedVelocitySecret.isEmpty()) {
+ this.secret = environmentSourcedVelocitySecret;
+ }
+
+ if (this.secret.isEmpty()) {
+ LOGGER.error("Velocity is enabled, but no secret key was specified. A secret key is required. Disabling velocity...");
+ this.enabled = false;
+ }