Skip to content

Commit 0376d74

Browse files
authored
update: [File] 파일 의존성 오류 수정 (#72)
1 parent 4d80ad0 commit 0376d74

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.runtracker.global.config;
2+
3+
import lombok.Getter;
4+
import org.springframework.beans.factory.annotation.Value;
5+
import org.springframework.context.annotation.Configuration;
6+
7+
import jakarta.annotation.PostConstruct;
8+
import java.io.File;
9+
10+
@Getter
11+
@Configuration
12+
public class FileUploadConfig {
13+
14+
@Value("${file.upload-dir:/app/uploads}")
15+
private String uploadDir;
16+
17+
@Value("${app.domain:http://localhost:8080}")
18+
private String baseUrl;
19+
20+
@PostConstruct
21+
public void init() {
22+
File uploadDirectory = new File(uploadDir);
23+
if (!uploadDirectory.exists() && !uploadDirectory.mkdirs()) {
24+
throw new IllegalStateException("Failed to create upload directory: " + uploadDir);
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)