Newer
Older
screenshot-server / src / main / java / com / screenshot / server / config / StorageConfig.java
package com.screenshot.server.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
@ConfigurationProperties(prefix = "storage")
public class StorageConfig {

    private String uploadDir = "./uploads";
    private int maxFileSizeMb = 100;
    private List<String> allowedExtensions = List.of("zip", "png", "jpg", "jpeg");

    public String getUploadDir() {
        return uploadDir;
    }

    public void setUploadDir(String uploadDir) {
        this.uploadDir = uploadDir;
    }

    public int getMaxFileSizeMb() {
        return maxFileSizeMb;
    }

    public void setMaxFileSizeMb(int maxFileSizeMb) {
        this.maxFileSizeMb = maxFileSizeMb;
    }

    public long getMaxFileSizeBytes() {
        return maxFileSizeMb * 1024L * 1024L;
    }

    public List<String> getAllowedExtensions() {
        return allowedExtensions;
    }

    public void setAllowedExtensions(List<String> allowedExtensions) {
        this.allowedExtensions = allowedExtensions;
    }
}