[ADD] StorageStaticConfig 추가 및 로컬 스토리지 경로를 HTTP로 매핑, FileSystemStorageProvider URL 포맷 변경, Kubernetes PVC 설정 추가, MinIO 표현을 스토리지로 수정
parent
92250f29d8
commit
254db5108a
@ -0,0 +1,36 @@
|
||||
package kr.re.etri.autoflow.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Configuration
|
||||
public class StorageStaticConfig implements WebMvcConfigurer {
|
||||
|
||||
@Value("${storage.local.base-path:/app/storage}")
|
||||
private String basePath;
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
// PVC 마운트 경로를 HTTP로 접근 가능하도록 설정
|
||||
// 예: /api/storage/mlpipeline/test.txt -> /app/storage/mlpipeline/test.txt 호출
|
||||
|
||||
String location = basePath;
|
||||
if (!location.endsWith("/")) {
|
||||
location += "/";
|
||||
}
|
||||
|
||||
// Windows 환경 고려 (C:/... 형식일 경우 file:///C:/...)
|
||||
if (!location.startsWith("/") && location.contains(":")) {
|
||||
location = "file:///" + location;
|
||||
} else {
|
||||
location = "file:" + location;
|
||||
}
|
||||
|
||||
registry.addResourceHandler("/api/storage/**")
|
||||
.addResourceLocations(location);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue