Skip to content

Commit

Permalink
Set default Mineskin API key using environment variable
Browse files Browse the repository at this point in the history
Updated the API key initialization to use `System.getenv` for retrieving the `MINESKIN_API_KEY`, falling back to an empty string if not set. This improves flexibility and security by supporting environment-based configuration.
  • Loading branch information
NonSwag committed Jan 18, 2025
1 parent 35ff124 commit 541aae0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import java.io.File;
import java.net.URL;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;

// https://docs.mineskin.org/docs/category/mineskin-api
Expand All @@ -21,7 +22,7 @@ public PaperSkinFactory(CharacterPlugin plugin) {
.requestHandler((userAgent, apiKey, timeout, gson) ->
new Java11RequestHandler(userAgent, apiKey.isBlank() ? null : apiKey, timeout, gson))
.userAgent("Characters/" + plugin.getPluginMeta().getVersion())
.apiKey("")
.apiKey(Objects.requireNonNullElse(System.getenv("MINESKIN_API_KEY"), ""))
.timeout(3000)
.build();
}
Expand Down

0 comments on commit 541aae0

Please sign in to comment.