yes?
All checks were successful
Deploy API / deploy (ubuntu-latest, 2.44.0) (push) Successful in 1m16s
All checks were successful
Deploy API / deploy (ubuntu-latest, 2.44.0) (push) Successful in 1m16s
This commit is contained in:
parent
158e42b053
commit
7ad2bf708b
@ -6,6 +6,9 @@ import lombok.extern.log4j.Log4j2;
|
|||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -32,4 +35,20 @@ public class PulseAPI {
|
|||||||
log.info("Found configuration at '{}'", config.getAbsolutePath());
|
log.info("Found configuration at '{}'", config.getAbsolutePath());
|
||||||
SpringApplication.run(PulseAPI.class, args); // Start the app
|
SpringApplication.run(PulseAPI.class, args); // Start the app
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public WebMvcConfigurer corsConfigurer() {
|
||||||
|
return new WebMvcConfigurer() {
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(@NonNull CorsRegistry registry) {
|
||||||
|
// Allow all origins to access the API
|
||||||
|
registry.addMapping("/*")
|
||||||
|
.allowedOrigins("*") // Allow all origins
|
||||||
|
.allowedMethods("*") // Allow all methods
|
||||||
|
.allowedHeaders("*"); // Allow all headers
|
||||||
|
// registry.addMapping("/*")
|
||||||
|
// .allowedOrigins("http://localhost:9000");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,36 +0,0 @@
|
|||||||
package cc.pulseapp.api.config;
|
|
||||||
|
|
||||||
import jakarta.annotation.PostConstruct;
|
|
||||||
import lombok.NonNull;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Braydon
|
|
||||||
*/
|
|
||||||
@Configuration @Log4j2(topic = "App Config")
|
|
||||||
public class AppConfig {
|
|
||||||
@PostConstruct
|
|
||||||
public void init() {
|
|
||||||
log.info("App Config initialized");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public WebMvcConfigurer configureCors() {
|
|
||||||
return new WebMvcConfigurer() {
|
|
||||||
@Override
|
|
||||||
public void addCorsMappings(@NonNull CorsRegistry registry) {
|
|
||||||
log.info("Configuring CORS...");
|
|
||||||
|
|
||||||
// Allow all origins to access the API
|
|
||||||
registry.addMapping("*")
|
|
||||||
.allowedOrigins("*") // Allow all origins
|
|
||||||
.allowedMethods("*") // Allow all methods
|
|
||||||
.allowedHeaders("*"); // Allow all headers
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user