66
77import io .quarkiverse .githubapp .Credentials ;
88import io .quarkus .runtime .annotations .ConfigGroup ;
9- import io .quarkus .runtime .annotations .ConfigItem ;
109import io .quarkus .runtime .annotations .ConfigPhase ;
1110import io .quarkus .runtime .annotations .ConfigRoot ;
12- import io .quarkus .runtime .annotations .ConvertWith ;
1311import io .quarkus .runtime .configuration .TrimmedStringConverter ;
12+ import io .smallrye .config .ConfigMapping ;
13+ import io .smallrye .config .WithConverter ;
14+ import io .smallrye .config .WithDefault ;
1415
15- @ ConfigRoot (name = "github-app" , phase = ConfigPhase .RUN_TIME )
16- public class GitHubAppRuntimeConfig {
16+ @ ConfigRoot (phase = ConfigPhase .RUN_TIME )
17+ @ ConfigMapping (prefix = "quarkus.github-app" )
18+ public interface GitHubAppRuntimeConfig {
1719
1820 /**
1921 * The numeric application id provided by GitHub.
2022 * <p>
2123 * Optional for tests, but mandatory in production and dev mode.
2224 */
23- @ ConfigItem
24- @ ConvertWith (TrimmedStringConverter .class )
25- Optional <String > appId ;
25+ @ WithConverter (TrimmedStringConverter .class )
26+ Optional <String > appId ();
2627
2728 /**
2829 * The GitHub name of the application.
2930 * <p>
3031 * Optional, only used for improving the user experience.
3132 */
32- @ ConfigItem
33- @ ConvertWith (TrimmedStringConverter .class )
34- Optional <String > appName ;
33+ @ WithConverter (TrimmedStringConverter .class )
34+ Optional <String > appName ();
3535
3636 /**
3737 * Read the configuration files from the source repository in case of a fork.
3838 */
39- @ ConfigItem ( defaultValue = "false" )
40- boolean readConfigFilesFromSourceRepository ;
39+ @ WithDefault ( "false" )
40+ boolean readConfigFilesFromSourceRepository () ;
4141
4242 /**
4343 * The RSA private key.
4444 * <p>
4545 * Optional for tests, but mandatory in production and dev mode.
4646 */
47- @ ConfigItem
48- @ ConvertWith (PrivateKeyConverter .class )
49- Optional <PrivateKey > privateKey ;
47+ @ WithConverter (PrivateKeyConverter .class )
48+ Optional <PrivateKey > privateKey ();
5049
5150 /**
5251 * The webhook URL path on which the GitHub App route is mounted.
5352 * <p>
5453 * It defaults to the root {@code /} but it can be configured to another path such as {@code /github-events} to enable
5554 * deployment alongside other HTTP routes.
5655 */
57- @ ConfigItem ( defaultValue = "/" )
58- @ ConvertWith (TrimmedStringConverter .class )
59- String webhookUrlPath ;
56+ @ WithDefault ( "/" )
57+ @ WithConverter (TrimmedStringConverter .class )
58+ String webhookUrlPath () ;
6059
6160 /**
6261 * The webhook secret if defined in the GitHub UI.
6362 */
64- @ ConfigItem
65- Optional <String > webhookSecret ;
63+ Optional <String > webhookSecret ();
6664
6765 /**
6866 * The credentials provider name.
@@ -71,9 +69,8 @@ public class GitHubAppRuntimeConfig {
7169 * <p>
7270 * Key names are defined in {@link Credentials}.
7371 */
74- @ ConfigItem
75- @ ConvertWith (TrimmedStringConverter .class )
76- Optional <String > credentialsProvider ;
72+ @ WithConverter (TrimmedStringConverter .class )
73+ Optional <String > credentialsProvider ();
7774
7875 /**
7976 * The credentials provider bean name.
@@ -84,58 +81,54 @@ public class GitHubAppRuntimeConfig {
8481 * <p>
8582 * For Vault, the credentials provider bean name is {@code vault-credentials-provider}.
8683 */
87- @ ConfigItem
88- @ ConvertWith (TrimmedStringConverter .class )
89- Optional <String > credentialsProviderName ;
84+ @ WithConverter (TrimmedStringConverter .class )
85+ Optional <String > credentialsProviderName ();
9086
9187 /**
9288 * The Smee.io proxy URL used when testing locally.
9389 */
94- @ ConfigItem
95- @ ConvertWith (TrimmedStringConverter .class )
96- Optional <String > webhookProxyUrl ;
90+ @ WithConverter (TrimmedStringConverter .class )
91+ Optional <String > webhookProxyUrl ();
9792
9893 /**
9994 * The GitHub instance endpoint.
10095 * <p>
10196 * Defaults to the public github.com instance.
10297 */
103- @ ConfigItem ( defaultValue = "https://api.github.com" )
104- @ ConvertWith (TrimmedStringConverter .class )
105- String instanceEndpoint ;
98+ @ WithDefault ( "https://api.github.com" )
99+ @ WithConverter (TrimmedStringConverter .class )
100+ String instanceEndpoint () ;
106101
107102 /**
108103 * The REST API endpoint.
109104 * <p>
110105 * Defaults to the public github.com instance REST API endpoint.
111106 */
112- @ ConfigItem ( defaultValue = "${quarkus.github-app.instance-endpoint}" )
113- @ ConvertWith (TrimmedStringConverter .class )
114- String restApiEndpoint ;
107+ @ WithDefault ( "${quarkus.github-app.instance-endpoint}" )
108+ @ WithConverter (TrimmedStringConverter .class )
109+ String restApiEndpoint () ;
115110
116111 /**
117112 * The GraphQL API endpoint.
118113 * <p>
119114 * Defaults to the public github.com instance GraphQL endpoint.
120115 */
121- @ ConfigItem ( defaultValue = "${quarkus.github-app.instance-endpoint}/graphql" )
122- @ ConvertWith (TrimmedStringConverter .class )
123- String graphqlApiEndpoint ;
116+ @ WithDefault ( "${quarkus.github-app.instance-endpoint}/graphql" )
117+ @ WithConverter (TrimmedStringConverter .class )
118+ String graphqlApiEndpoint () ;
124119
125120 /**
126121 * Debug configuration.
127122 */
128- @ ConfigItem
129- Debug debug ;
123+ Debug debug ();
130124
131125 @ ConfigGroup
132- public static class Debug {
126+ public interface Debug {
133127
134128 /**
135129 * A directory in which the payloads are saved.
136130 */
137- @ ConfigItem
138- @ ConvertWith (TrimmedStringConverter .class )
139- public Optional <Path > payloadDirectory ;
131+ @ WithConverter (TrimmedStringConverter .class )
132+ public Optional <Path > payloadDirectory ();
140133 }
141134}
0 commit comments