13
0
geforkt von Mirrors/Velocity

Graceful fallback if these values are absent

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-06-27 23:03:47 -04:00
Ursprung 62703780e1
Commit 7fd76962f2

Datei anzeigen

@ -383,14 +383,14 @@ public class VelocityConfiguration implements ProxyConfig {
// Handle any cases where the config needs to be saved again // Handle any cases where the config needs to be saved again
byte[] forwardingSecret; byte[] forwardingSecret;
String forwardingSecretString = config.get("forwarding-secret"); String forwardingSecretString = config.get("forwarding-secret");
if (forwardingSecretString.isEmpty()) { if (forwardingSecretString == null || forwardingSecretString.isEmpty()) {
forwardingSecretString = generateRandomString(12); forwardingSecretString = generateRandomString(12);
config.set("forwarding-secret", forwardingSecretString); config.set("forwarding-secret", forwardingSecretString);
mustResave = true; mustResave = true;
} }
forwardingSecret = forwardingSecretString.getBytes(StandardCharsets.UTF_8); forwardingSecret = forwardingSecretString.getBytes(StandardCharsets.UTF_8);
if (config.<String>get("metrics.id").isEmpty()) { if (!config.contains("metrics.id") || config.<String>get("metrics.id").isEmpty()) {
config.set("metrics.id", UUID.randomUUID().toString()); config.set("metrics.id", UUID.randomUUID().toString());
mustResave = true; mustResave = true;
} }