Skip to content

Commit 1cb2bf4

Browse files
authored
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.
1 parent 78feecb commit 1cb2bf4

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

patches/server/0005-Paper-config-files.patch

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,10 @@ index 0000000000000000000000000000000000000000..d9502ba028a96f9cc846f9ed428bd806
487487
+}
488488
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
489489
new file mode 100644
490-
index 0000000000000000000000000000000000000000..45ab7ff5497ceccb85944d2e8d354d9c860abf3b
490+
index 0000000000000000000000000000000000000000..b92bfd89e32becde2e7630c6116c16f8a4f6614a
491491
--- /dev/null
492492
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
493-
@@ -0,0 +1,324 @@
493+
@@ -0,0 +1,331 @@
494494
+package io.papermc.paper.configuration;
495495
+
496496
+import co.aikar.timings.MinecraftTimings;
@@ -594,7 +594,14 @@ index 0000000000000000000000000000000000000000..45ab7ff5497ceccb85944d2e8d354d9c
594594
+
595595
+ @PostProcess
596596
+ private void postProcess() {
597-
+ if (this.enabled && this.secret.isEmpty()) {
597+
+ if (!this.enabled) return;
598+
+
599+
+ final String environmentSourcedVelocitySecret = System.getenv("PAPER_VELOCITY_SECRET");
600+
+ if (environmentSourcedVelocitySecret != null && !environmentSourcedVelocitySecret.isEmpty()) {
601+
+ this.secret = environmentSourcedVelocitySecret;
602+
+ }
603+
+
604+
+ if (this.secret.isEmpty()) {
598605
+ LOGGER.error("Velocity is enabled, but no secret key was specified. A secret key is required. Disabling velocity...");
599606
+ this.enabled = false;
600607
+ }
@@ -5216,7 +5223,7 @@ index e433037a03ffafabb952887ae3980e1d51411d4c..c061813d275fbc48d7629cc59d90dbb4
52165223
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
52175224

52185225
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
5219-
index 3c0691ef65c8db1002b76984f4ddfe2072d793c9..b3c4cdd9cfff6857f3007fbd91a280bcc53ab072 100644
5226+
index 10f07a6eff8f738cefef11829dd774874259b8f4..4c5b6f8d63e4c60a1dc81e68117fa049b956819a 100644
52205227
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
52215228
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
52225229
@@ -962,6 +962,7 @@ public final class CraftServer implements Server {

patches/server/0740-Configurable-chat-thread-limit.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ is actually processed, this is honestly really just exposed for the misnomers or
2222
who just wanna ensure that this won't grow over a specific size if chat gets stupidly active
2323

2424
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
25-
index 45ab7ff5497ceccb85944d2e8d354d9c860abf3b..917bd0c1dd8f356edc3741ee59d24e4d090af182 100644
25+
index b92bfd89e32becde2e7630c6116c16f8a4f6614a..73e8a524925ed6f2580d3bd01616646fabafda78 100644
2626
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
2727
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
28-
@@ -296,7 +296,18 @@ public class GlobalConfiguration extends ConfigurationPart {
28+
@@ -303,7 +303,18 @@ public class GlobalConfiguration extends ConfigurationPart {
2929

3030
@PostProcess
3131
private void postProcess() {

patches/server/0981-Moonrise-optimisation-patches.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22216,7 +22216,7 @@ index 0000000000000000000000000000000000000000..85950a1aa732ab8c01ad28bec9e0de14
2221622216
+ }
2221722217
+}
2221822218
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
22219-
index f19b4a17a7e22969f7b51d3bea4056b41ab25484..690086adcb1f87adc0b3ab664fde735ad3e1093a 100644
22219+
index 450a1cc8f1624dce2daf52210d017e0732b1bdf7..a9dd0e5216e95afd98fd2200d110e2cc0b1b0dca 100644
2222022220
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
2222122221
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
2222222222
@@ -31,6 +31,45 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -22265,7 +22265,7 @@ index f19b4a17a7e22969f7b51d3bea4056b41ab25484..690086adcb1f87adc0b3ab664fde735a
2226522265
static void set(GlobalConfiguration instance) {
2226622266
GlobalConfiguration.instance = instance;
2226722267
}
22268-
@@ -139,21 +178,6 @@ public class GlobalConfiguration extends ConfigurationPart {
22268+
@@ -146,21 +185,6 @@ public class GlobalConfiguration extends ConfigurationPart {
2226922269
public int incomingPacketThreshold = 300;
2227022270
}
2227122271

@@ -22287,7 +22287,7 @@ index f19b4a17a7e22969f7b51d3bea4056b41ab25484..690086adcb1f87adc0b3ab664fde735a
2228722287
public UnsupportedSettings unsupportedSettings;
2228822288

2228922289
public class UnsupportedSettings extends ConfigurationPart {
22290-
@@ -212,7 +236,7 @@ public class GlobalConfiguration extends ConfigurationPart {
22290+
@@ -219,7 +243,7 @@ public class GlobalConfiguration extends ConfigurationPart {
2229122291

2229222292
@PostProcess
2229322293
private void postProcess() {

0 commit comments

Comments
 (0)