Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment variable to set velocity secret. #6333

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Noah van der Aa <ndvdaa@gmail.com>
Date: Thu, 5 Aug 2021 16:08:23 +0200
Subject: [PATCH] Add environment variable to set velocity secret.


diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 95d8cf449bf0439fddaf319246fef51e1570b68e..8e497a05e3d430cd2047788b032bca6fcb6c7bda 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -356,7 +356,7 @@ public class PaperConfig {
private static void velocitySupport() {
velocitySupport = getBoolean("settings.velocity-support.enabled", false);
velocityOnlineMode = getBoolean("settings.velocity-support.online-mode", false);
- String secret = getString("settings.velocity-support.secret", "");
+ String secret = java.util.Objects.requireNonNullElse(System.getenv("VELOCITY_SECRET"), getString("settings.velocity-support.secret", ""));
NoahvdAa marked this conversation as resolved.
Show resolved Hide resolved
if (velocitySupport && secret.isEmpty()) {
fatal("Velocity support is enabled, but no secret key was specified. A secret key is required!");
} else {