diff --git a/build.gradle b/build.gradle index 6977379..7b5229c 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,6 @@ dependencies { implementation 'org.springframework.cloud:spring-cloud-config-server' implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' - implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap' implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' diff --git a/src/main/java/dev/mars3142/fhq/config/ConfigServiceApplication.java b/src/main/java/dev/mars3142/fhq/config/ConfigServiceApplication.java index c0c8a41..488fd8c 100644 --- a/src/main/java/dev/mars3142/fhq/config/ConfigServiceApplication.java +++ b/src/main/java/dev/mars3142/fhq/config/ConfigServiceApplication.java @@ -2,8 +2,10 @@ package dev.mars3142.fhq.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.config.server.EnableConfigServer; @SpringBootApplication +@EnableConfigServer public class ConfigServiceApplication { public static void main(String[] args) { diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/application.yml similarity index 73% rename from src/main/resources/bootstrap.yml rename to src/main/resources/application.yml index e11f9e4..623aaa1 100644 --- a/src/main/resources/bootstrap.yml +++ b/src/main/resources/application.yml @@ -1,9 +1,3 @@ -logging: - level: - com: - netflix: - discovery: off - server: port: ${PORT:8888} @@ -15,3 +9,5 @@ spring: server: native: search-locations: classpath:/configurations + profiles: + active: native diff --git a/src/main/resources/configurations/application.yml b/src/main/resources/configurations/application.yml index acd5aea..36e6be0 100644 --- a/src/main/resources/configurations/application.yml +++ b/src/main/resources/configurations/application.yml @@ -16,7 +16,7 @@ logging: level: com: netflix: - discovery: ERROR + discovery: off management: endpoint: diff --git a/src/main/resources/configurations/edge-service.yml b/src/main/resources/configurations/edge-service.yml new file mode 100644 index 0000000..1008f0b --- /dev/null +++ b/src/main/resources/configurations/edge-service.yml @@ -0,0 +1,50 @@ +server: + port: ${PORT:8080} + +spring: + cloud: + gateway: + default-filters: + - name: Retry + args: + retries: 3 + methods: GET + series: SERVER_ERROR + exceptions: java.io.IOException, java.util.concurrent.TimeoutException + backoff: + firstBackoff: 50ms + maxBackoff: 5000ms + discovery: + locator: + enabled: false + routes: + - id: edge + uri: lb://edge-service + predicates: + - Path=/v3/api-docs/** + filters: + - RewritePath=/v3/api-docs/(?.*), /$\{path}/v3/api-docs + + - id: timezone-service + uri: lb://timezone-service + predicates: + - Path=/v1/timezone/**, /health/timezone, /timezone/v3/api-docs + filters: + - RewritePath=/health/timezone, /actuator/health + - RewritePath=/timezone/(?.*), /$\{segment} + + - id: google-service + uri: ${GOOGLE_SERVICE_URI:http://google-service.web:8080} + predicates: + - Path=/v1/account/**, /health/google, /google/v3/api-docs + filters: + - RewritePath=/health/google, /actuator/health + - RewritePath=/google/(?.*), /$\{segment} + + - id: token-service + uri: ${BACKEND_SERVICE_URI:http://backend-service.web:8080} + predicates: + - Path=/v1/token/**, /health/backend, /token/v3/api-docs + filters: + - RewritePath=/health/backend, /actuator/health + - RewritePath=/token/(?.*), /$\{segment}