mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 07:25:10 +00:00
subo web config a app java
This commit is contained in:
parent
6b8fcf28c4
commit
d7c6a7a77c
1 changed files with 21 additions and 11 deletions
|
|
@ -25,17 +25,13 @@ import org.hyperledger.fabric.client.identity.Signers;
|
|||
import org.hyperledger.fabric.client.identity.X509Identity;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.beans.BeanProperty;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
|
|
@ -85,6 +81,20 @@ public class App {
|
|||
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebMvcConfigurer corsConfigurer() {
|
||||
return new WebMvcConfigurer() {
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOrigins("http://localhost:5173", "http://localhost:3005") // Cambia esto a tu dominio de origen
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
||||
.allowedHeaders("*")
|
||||
.allowCredentials(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/*private static ManagedChannel newGrpcConnection() throws IOException {
|
||||
var credentials = TlsChannelCredentials.newBuilder()
|
||||
.trustManager(TLS_CERT_PATH.toFile())
|
||||
|
|
|
|||
Loading…
Reference in a new issue