-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
ConfigResource.java
47 lines (38 loc) · 1.18 KB
/
ConfigResource.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package io.quarkus.it.smallrye.config;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.eclipse.microprofile.config.ConfigProvider;
import io.quarkus.runtime.annotations.RegisterForReflection;
import io.smallrye.config.SmallRyeConfig;
@Path("/config")
@Produces(MediaType.APPLICATION_JSON)
public class ConfigResource {
@Inject
SmallRyeConfig config;
@GET
@Path("/{name}")
public Response configValue(@PathParam("name") final String name) {
return Response.ok(config.getConfigValue(name)).build();
}
@GET
@Path("/profiles")
public Response profiles() {
return Response.ok(config.getProfiles()).build();
}
@GET
@Path("/uuid")
public Response uuid() {
return Response.ok(ConfigProvider.getConfig().getConfigValue("quarkus.uuid")).build();
}
@RegisterForReflection(targets = {
org.eclipse.microprofile.config.ConfigValue.class,
io.smallrye.config.ConfigValue.class
})
public static class ConfigValueReflection {
}
}