Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ class CorsConfig : WebFluxConfigurer {
@Value("\${app.cors.allowed-hosts}")
private lateinit var hosts: Array<String>

@Value("\${app.cors.allowed-patterns}")
private lateinit var patterns: Array<String>

override fun addCorsMappings(registry: CorsRegistry) {
registry.addMapping("/**")
.allowedOrigins(*hosts)
.allowedOriginPatterns(*patterns)
.allowedHeaders("*")
.allowedMethods("*")
}
Expand Down
1 change: 1 addition & 0 deletions Api/api-app/src/main/resources/application-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ spring:
app:
cors:
allowed-hosts: https://opex.dev, http://localhost:3000
allowed-patterns: http://192.168.*
accountant:
url: lb://opex-accountant
matching-gateway:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package co.nilin.opex.wallet.app.config

import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Configuration
import org.springframework.web.reactive.config.CorsRegistry
import org.springframework.web.reactive.config.WebFluxConfigurer

@Configuration
class CorsConfig : WebFluxConfigurer {

@Value("\${app.cors.allowed-hosts}")
private lateinit var hosts: Array<String>

@Value("\${app.cors.allowed-patterns}")
private lateinit var patterns: Array<String>

override fun addCorsMappings(registry: CorsRegistry) {
registry.addMapping("/**")
.allowedOrigins(*hosts)
.allowedOriginPatterns(*patterns)
.allowedHeaders("*")
.allowedMethods("*")
}

}
7 changes: 6 additions & 1 deletion Wallet/wallet-app/src/main/resources/application-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ spring:
cloud:
consul:
host: ${CONSUL_HOST}
port: 8500
port: 8500

app:
cors:
allowed-hosts: https://opex.dev, http://localhost:3000
allowed-patterns: http://192.168.*