new settings

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2024-10-14 22:51:45 +02:00
parent d208681580
commit f9b73fc267
5 changed files with 83 additions and 17 deletions

View File

@@ -45,6 +45,7 @@ dependencies {
implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8' implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-api:2.6.0' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-api:2.6.0'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
testImplementation 'io.projectreactor:reactor-test' testImplementation 'io.projectreactor:reactor-test'
compileOnly 'org.projectlombok:lombok' compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools' developmentOnly 'org.springframework.boot:spring-boot-devtools'

View File

@@ -0,0 +1,32 @@
package dev.mars3142.fhq.config;
import java.util.ArrayList;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.cloud.gateway.route.RouteDefinition;
import org.springframework.cloud.gateway.route.RouteDefinitionLocator;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@RequiredArgsConstructor
public class OpenAPIConfiguration {
private final RouteDefinitionLocator locator;
@Bean
public List<GroupedOpenApi> apis() {
List<GroupedOpenApi> groups = new ArrayList<>();
List<RouteDefinition> definitions = locator.getRouteDefinitions().collectList().block();
assert definitions != null;
definitions.stream().filter(routeDefinition -> routeDefinition.getId().matches(".*-service"))
.forEach(routeDefinition -> {
String name = routeDefinition.getId().replaceAll("-service", "");
groups.add(GroupedOpenApi.builder().pathsToMatch("/" + name + "/**").group(name).build());
});
return groups;
}
}

View File

@@ -5,3 +5,10 @@ eureka:
client: client:
service-url: service-url:
defaultZone: http://localhost:8761/eureka defaultZone: http://localhost:8761/eureka
logging:
level:
org:
springframework:
cloud:
gateway: TRACE

View File

@@ -4,8 +4,6 @@ eureka:
fetch-registry: true fetch-registry: true
service-url: service-url:
defaultZone: http://eureka-service.web:8761/eureka defaultZone: http://eureka-service.web:8761/eureka
instance:
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
info: info:
application: application:
@@ -36,15 +34,6 @@ sentry:
# We recommend adjusting this value in production. # We recommend adjusting this value in production.
tracesSampleRate: 1.0 tracesSampleRate: 1.0
springdoc:
swagger-ui:
path: /swagger-ui.html
urls:
- name: TimeZone Service
url: /aggregate/timezone/v3/api-docs
- name: Google Service
url: /aggregate/google/v3/api-docs
spring: spring:
application: application:
name: edge-service name: edge-service
@@ -60,27 +49,37 @@ spring:
backoff: backoff:
firstBackoff: 50ms firstBackoff: 50ms
maxBackoff: 5000ms maxBackoff: 5000ms
discovery:
locator:
enabled: false
routes: routes:
- id: edge
uri: lb://edge-service
predicates:
- Path=/v3/api-docs/**
filters:
- RewritePath=/v3/api-docs/(?<path>.*), /$\{path}/v3/api-docs
- id: timezone-service - id: timezone-service
uri: lb://timezone-service uri: lb://timezone-service
predicates: predicates:
- Path=/v1/timezone/**, /health/timezone, /aggregate/timezone/v3/api-docs - Path=/v1/timezone/**, /health/timezone, /timezone/v3/api-docs
filters: filters:
- RewritePath=/health/timezone, /actuator/health - RewritePath=/health/timezone, /actuator/health
- RewritePath=/aggregate/timezone/v3/api-docs, /v3/api-docs - RewritePath=/timezone/(?<segment>.*), /$\{segment}
- id: google-service - id: google-service
uri: ${GOOGLE_SERVICE_URI:http://google-service.web:8080} uri: ${GOOGLE_SERVICE_URI:http://google-service.web:8080}
predicates: predicates:
- Path=/v1/account/**, /health/google, /aggregate/google/v3/api-docs - Path=/v1/account/**, /health/google, /google/v3/api-docs
filters: filters:
- RewritePath=/health/google, /actuator/health - RewritePath=/health/google, /actuator/health
- RewritePath=/aggregate/google/v3/api-docs, /v3/api-docs - RewritePath=/google/(?<segment>.*), /$\{segment}
- id: token-service - id: token-service
uri: ${BACKEND_SERVICE_URI:http://backend-service.web:8080} uri: ${BACKEND_SERVICE_URI:http://backend-service.web:8080}
predicates: predicates:
- Path=/v1/token/**, /health/backend, /aggregate/backend/v3/api-docs - Path=/v1/token/**, /health/backend, /token/v3/api-docs
filters: filters:
- RewritePath=/health/backend, /actuator/health - RewritePath=/health/backend, /actuator/health
- RewritePath=/aggregate/backend/v3/api-docs, /v3/api-docs - RewritePath=/token/(?<segment>.*), /$\{segment}

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Rive Hello World</title>
</head>
<body>
<div style="text-align: center">
<canvas id="canvas" width="400" height="400"></canvas>
</div>
<script src="https://unpkg.com/@rive-app/canvas@2.20.0"></script>
<script>
const r = new rive.Rive({
src: "https://cdn.rive.app/animations/vehicles.riv",
canvas: document.getElementById("canvas"),
autoplay: true,
// artboard: "Arboard", // Optional. If not supplied the default is selected
stateMachines: "bumpy",
onLoad: () => {
// Ensure the drawing surface matches the canvas size and device pixel ratio
r.resizeDrawingSurfaceToCanvas();
},
});
</script>
</body>
</html>