Refactor Docker setup and update file storage paths for improved containerization
This commit is contained in:
@@ -23,6 +23,7 @@ public class JambotronApplication implements CommandLineRunner {
|
||||
logger.error("Application Run. This is an error message.");
|
||||
logger.debug("Application Run. This is a debug message.");
|
||||
logger.info("Application Run. This is an info message.");
|
||||
logger.info("Application Run. This is an info message.!!!!!!");
|
||||
}
|
||||
@Override
|
||||
public void run(String... arg) throws Exception {
|
||||
|
||||
@@ -178,17 +178,19 @@ public class TutorialController {
|
||||
try {
|
||||
|
||||
String imageFileName = FilesStorageServiceImpl.getFileNameFromUrl(tutorial.getTitleimage());
|
||||
|
||||
String servImageFileName = FilesStorageServiceImpl.getFileNameFromUrl(servTutorial.getTitleimage());
|
||||
filesStorageService.deletePublicFile(servImageFileName);
|
||||
|
||||
if(!servImageFileName.equals(imageFileName)){
|
||||
filesStorageService.deletePublicFile(servImageFileName);
|
||||
|
||||
Path path= filesStorageService.moveFile(
|
||||
user.getId().toString(),
|
||||
tutorial.getTitleimage(),
|
||||
String.format("Tutorial_%s",imageFileName )
|
||||
);
|
||||
Path path= filesStorageService.moveFile(
|
||||
user.getId().toString(),
|
||||
tutorial.getTitleimage(),
|
||||
String.format("Tutorial_%s",imageFileName )
|
||||
);
|
||||
|
||||
servTutorial.setTitleimage(FilesRoutingHelper.getPublicImageUrl(path.getFileName().toString()));
|
||||
servTutorial.setTitleimage(FilesRoutingHelper.getPublicImageUrl(path.getFileName().toString()));
|
||||
}
|
||||
|
||||
servTutorial = tutorialRepository.save(servTutorial);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -19,9 +19,14 @@ import java.util.stream.Stream;
|
||||
@Service
|
||||
public class FilesStorageServiceImpl implements FilesStorageService {
|
||||
|
||||
private final Path root = Paths.get("uploads/user-images/");
|
||||
// private final Path root = Paths.get("uploads/user-images/");
|
||||
//
|
||||
// private final Path rootPublic = Paths.get("uploads/public-images/");
|
||||
|
||||
// Update paths to use the Docker volume
|
||||
private final Path root = Paths.get("/jambotron_data/uploads/user-images/");
|
||||
private final Path rootPublic = Paths.get("/jambotron_data/uploads/public-images/");
|
||||
|
||||
private final Path rootPublic = Paths.get("uploads/public-images/");
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
Reference in New Issue
Block a user