File tree Expand file tree Collapse file tree 5 files changed +11
-12
lines changed
docs/modules/ROOT/pages/includes
runtime/src/main/java/io/quarkiverse/githubapp/runtime/config Expand file tree Collapse file tree 5 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ ifndef::add-copy-button-to-env-var[]
9494Environment variable: `+++QUARKUS_GITHUB_APP_PRIVATE_KEY+++`
9595endif::add-copy-button-to-env-var[]
9696--
97- |link:https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/security/PrivateKey.html[PrivateKey]
97+ |string
9898|
9999
100100a| [[quarkus-github-app_quarkus-github-app-webhook-url-path]] [.property-path]##link:#quarkus-github-app_quarkus-github-app-webhook-url-path[`quarkus.github-app.webhook-url-path`]##
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ ifndef::add-copy-button-to-env-var[]
9494Environment variable: `+++QUARKUS_GITHUB_APP_PRIVATE_KEY+++`
9595endif::add-copy-button-to-env-var[]
9696--
97- |link:https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/security/PrivateKey.html[PrivateKey]
97+ |string
9898|
9999
100100a| [[quarkus-github-app_quarkus-github-app-webhook-url-path]] [.property-path]##link:#quarkus-github-app_quarkus-github-app-webhook-url-path[`quarkus.github-app.webhook-url-path`]##
Original file line number Diff line number Diff line change @@ -43,12 +43,14 @@ public class CheckedConfigProvider {
4343 this .launchMode = launchMode ;
4444
4545 Map <String , String > credentials = getCredentials ();
46- String privateKeyFromCredentials = credentials .get (Credentials .PRIVATE_KEY );
47- if (privateKeyFromCredentials != null && !privateKeyFromCredentials .isBlank ()) {
48- this .privateKey = Optional .of (new PrivateKeyConverter ().convert (privateKeyFromCredentials .trim ()));
49- } else {
50- this .privateKey = gitHubAppRuntimeConfig .privateKey ();
46+
47+ String privateKey = credentials .get (Credentials .PRIVATE_KEY );
48+ if (privateKey == null || privateKey .isBlank ()) {
49+ privateKey = gitHubAppRuntimeConfig .privateKey ().orElse (null );
5150 }
51+ this .privateKey = privateKey != null ? Optional .of (new PrivateKeyConverter ().convert (privateKey .trim ()))
52+ : Optional .empty ();
53+
5254 String webhookSecretFromCredentials = credentials .get (Credentials .WEBHOOK_SECRET );
5355 if (webhookSecretFromCredentials != null && !webhookSecretFromCredentials .isBlank ()) {
5456 this .webhookSecret = Optional .of (webhookSecretFromCredentials .trim ());
Original file line number Diff line number Diff line change 11package io .quarkiverse .githubapp .runtime .config ;
22
33import java .nio .file .Path ;
4- import java .security .PrivateKey ;
54import java .util .Optional ;
65
76import io .quarkiverse .githubapp .Credentials ;
@@ -45,8 +44,7 @@ public interface GitHubAppRuntimeConfig {
4544 * <p>
4645 * Optional for tests, but mandatory in production and dev mode.
4746 */
48- @ WithConverter (PrivateKeyConverter .class )
49- Optional <PrivateKey > privateKey ();
47+ Optional <String > privateKey ();
5048
5149 /**
5250 * The webhook URL path on which the GitHub App route is mounted.
Original file line number Diff line number Diff line change 33import static io .quarkus .runtime .configuration .ConverterSupport .DEFAULT_QUARKUS_CONVERTER_PRIORITY ;
44
55import java .io .Serializable ;
6- import java .security .GeneralSecurityException ;
76import java .security .PrivateKey ;
87
98import jakarta .annotation .Priority ;
@@ -29,7 +28,7 @@ public PrivateKey convert(final String value) {
2928
3029 try {
3130 return PrivateKeyUtil .loadKey (privateKeyValue );
32- } catch (GeneralSecurityException e ) {
31+ } catch (Exception e ) {
3332 throw new ConfigurationException ("Unable to interpret the provided private key" , e );
3433 }
3534 }
You can’t perform that action at this time.
0 commit comments