Repository navigation
feat(minestom): read the velocity secret from a file in the demo lobby - #54
Merged
Merged
Conversation
The demo lobby only accepted the Velocity forwarding secret through the VELOCITY_SECRET environment variable, which hosts outside Kubernetes cannot inject. VELOCITY_SECRET_FILE now names a file holding the secret, read relative to the working directory and trimmed. A requested file that is missing, unreadable or blank stops startup instead of running without forwarding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Grus demo lobby only accepts the Velocity forwarding secret as an environment variable. Lobbies running in Kubernetes get it injected from a secret, but the Grus agent runs on hosts outside Kubernetes and has no way to pass that secret in. Those lobbies either start without forwarding, which breaks player identity behind the proxy, or cannot be started at all.
Approach
The lobby now also accepts a file path. If the secret variable is empty and the file variable is set, the lobby reads the secret from that file, relative to its working directory, and strips surrounding whitespace. If the file is missing, unreadable or blank, startup stops with a message naming the file. The lobby never starts without forwarding when a secret file was requested. The secret itself is never logged.
Testing
Unit tests cover the resolution rules: environment precedence, empty variables, trimming, relative paths, and the failure cases. Run with
./gradlew :grus-demo-minestom:test :grus-demo-minestom:shadowJar.