diff --git a/dummy/src/main/resources/application-docker.yml b/dummy/src/main/resources/application-docker.yml new file mode 100644 index 0000000..a1d77c1 --- /dev/null +++ b/dummy/src/main/resources/application-docker.yml @@ -0,0 +1,2 @@ +app: + eureka-server: eureka \ No newline at end of file diff --git a/dummy/src/main/resources/application.properties b/dummy/src/main/resources/application.properties deleted file mode 100644 index 1f1e339..0000000 --- a/dummy/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=dummy diff --git a/dummy/src/main/resources/application.yml b/dummy/src/main/resources/application.yml new file mode 100644 index 0000000..a50a127 --- /dev/null +++ b/dummy/src/main/resources/application.yml @@ -0,0 +1,36 @@ +app: + eureka-server: localhost + +server: + port: 0 + +spring: + application: + name: dummy + + # TODO remove after testing + security: + user: + name: admin + password: admin + +springdoc: + enable-native-support: true + api-docs: + enabled: true + path: /api/v1/dummy/v3/api-docs + swagger-ui: + path: /api/v1/dummy/swagger-ui.html + +management: + endpoints: + web: + exposure: + include: "*" + +eureka: + client: + service-url: + defaultZone: http://localhost:8761/eureka + # Will only work when docker is used + # defaultZone: http://${app.eureka-server}:8761/eureka diff --git a/eureka/src/main/resources/application.properties b/eureka/src/main/resources/application.properties deleted file mode 100644 index bb67d3e..0000000 --- a/eureka/src/main/resources/application.properties +++ /dev/null @@ -1,10 +0,0 @@ -spring.application.name=eureka - -server.port=8761 - -spring.security.user.name=admin -spring.security.user.password=admin - -eureka.instance.hostname=localhost -eureka.client.register-with-eureka=false -eureka.client.fetch-registry=false \ No newline at end of file diff --git a/eureka/src/main/resources/application.yml b/eureka/src/main/resources/application.yml new file mode 100644 index 0000000..d0a78e1 --- /dev/null +++ b/eureka/src/main/resources/application.yml @@ -0,0 +1,18 @@ +server: + port: 8761 + +eureka: + client: + register-with-eureka: false + fetch-registry: false + instance: + hostname: localhost + +spring: + application: + name: eureka + security: + # TODO remove after testing + user: + name: admin + password: admin \ No newline at end of file diff --git a/gateway/src/main/resources/application-docker.yml b/gateway/src/main/resources/application-docker.yml new file mode 100644 index 0000000..a1d77c1 --- /dev/null +++ b/gateway/src/main/resources/application-docker.yml @@ -0,0 +1,2 @@ +app: + eureka-server: eureka \ No newline at end of file diff --git a/gateway/src/main/resources/application.properties b/gateway/src/main/resources/application.properties deleted file mode 100644 index 811acbf..0000000 --- a/gateway/src/main/resources/application.properties +++ /dev/null @@ -1,25 +0,0 @@ -spring.application.name=gateway -app.eureka-server=localhost - -eureka.client.service-url.defaultZone=http://localhost:8761/eureka -server.port=8181 -server.servlet.context-path=/ - -spring.cloud.discovery.enabled=true - -# TODO change these back to lambda's stuffs -spring.cloud.gateway.mvc.routes[0].id=discovery-server -spring.cloud.gateway.mvc.routes[0].uri=http://${app.eureka-server}:8761 -spring.cloud.gateway.mvc.routes[0].predicates[0]=Path=/eureka/web -spring.cloud.gateway.mvc.routes[0].filters[0]=SetPath=/ - -springdoc.enable-javadoc=true -springdoc.api-docs.enabled=true -springdoc.api-docs.groups.enabled=true -springdoc.swagger-ui.enabled=true -springdoc.swagger-ui.path=/swagger-ui.html -springdoc.swagger-ui.config-url=/v3/api-docs/swagger-config - - -springdoc.swagger-ui.urls[0].name=Api Gateway APIs -springdoc.swagger-ui.urls[0].url=/v3/api-docs \ No newline at end of file diff --git a/gateway/src/main/resources/application.yml b/gateway/src/main/resources/application.yml new file mode 100644 index 0000000..9b2ea0b --- /dev/null +++ b/gateway/src/main/resources/application.yml @@ -0,0 +1,81 @@ +server: + port: 8181 + +spring: + application: + name: gateway + + cloud: + gateway: + discovery: + locator: + enabled: true + routes: + # eureka service routing + - id: eureka + # Will only work when docker is used + # uri: http://${app.eureka-server}:8761 + uri: http://localhost:8761 + predicates: + - Path=/eureka/web + filters: + - SetPath=/ + - id: eureka-static + # Will only work when docker is used + # uri: http://${app.eureka-server}:8761 + uri: http://localhost:8761 + predicates: + - Path=/eureka/** + # dummy service routing + # TODO smth is wrong with this + - id: dummy + uri: lb://dummy + predicates: + - Path=/api/v1/dummy/** + filters: + - AddResponseHeader=X-Powered-By, LearningPulse Gateway Service + security: + user: + name: admin + password: admin + + +# Keycloak configuration for the future +# security: +# oauth2: +# resourceserver: +# jwt: +# issuer-uri: ${KEYCLOAK_URL}/realms/LearningPulse +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: always + gateway: + enabled: true + +springdoc: + enable-native-support: true + api-docs: + enabled: true + groups: + enabled: true + swagger-ui: + path: /swagger-ui.html + config-url: /v3/api-docs/swagger-config + urls: + - name: Gateway API + url: /v3/api-docs + # TODO not working rn + - name: Dummy Service API + url: /api/v1/dummy/v3/api-docs + +eureka: + client: + service-url: + defaultZone: http://localhost:8761/eureka + # Will only work when docker is used + # defaultZone: http://${app.eureka-server}:8761/eureka