🚧 Add logging
This commit is contained in:
parent
068cc57639
commit
470516d5da
@ -1,8 +1,10 @@
|
|||||||
package dev.dinauer.oidcproxy.startup;
|
package dev.dinauer.oidcproxy.startup;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.Strings;
|
import org.apache.commons.lang3.Strings;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public record ProxyRoute(String path, String target, String strategy)
|
public record ProxyRoute(String path, String target, String strategy)
|
||||||
{
|
{
|
||||||
@ -18,6 +20,6 @@ public record ProxyRoute(String path, String target, String strategy)
|
|||||||
|
|
||||||
public List<String> segments()
|
public List<String> segments()
|
||||||
{
|
{
|
||||||
return List.of(path.split("/"));
|
return Stream.of(path.split("/")).filter(item -> !StringUtils.isBlank(item)).toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,8 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.apache.commons.lang3.Strings;
|
import org.apache.commons.lang3.Strings;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import tools.jackson.databind.ObjectMapper;
|
import tools.jackson.databind.ObjectMapper;
|
||||||
import tools.jackson.dataformat.yaml.YAMLFactory;
|
import tools.jackson.dataformat.yaml.YAMLFactory;
|
||||||
|
|
||||||
@ -20,6 +22,8 @@ import java.util.Optional;
|
|||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
public class RouteService
|
public class RouteService
|
||||||
{
|
{
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(RouteService.class);
|
||||||
|
|
||||||
@ConfigProperty(name = "oidc.proxy.routes.config.location")
|
@ConfigProperty(name = "oidc.proxy.routes.config.location")
|
||||||
String configLocation;
|
String configLocation;
|
||||||
|
|
||||||
@ -42,6 +46,10 @@ public class RouteService
|
|||||||
result.add(new ProxyRoute(StringUtils.join(rules.root(), route.path()), route.target(), route.strategy()));
|
result.add(new ProxyRoute(StringUtils.join(rules.root(), route.path()), route.target(), route.strategy()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (ProxyRoute route : result)
|
||||||
|
{
|
||||||
|
LOG.info("Registered route: {} -> {}", route.segments(), route.target());
|
||||||
|
}
|
||||||
this.routes = result;
|
this.routes = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
root: /api
|
|
||||||
routes:
|
routes:
|
||||||
- path: /oidc
|
- path: /api
|
||||||
target: http://localhost:8089/api/iam-backend
|
target: http://localhost:8089/api/iam-backend
|
||||||
strategy: NONE
|
strategy: NONE
|
||||||
- path: /
|
- path: /
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user