|
| 1 | +package ao.creativemode.kixi.config; |
| 2 | + |
| 3 | +import org.springframework.boot.context.properties.ConfigurationProperties; |
| 4 | +import org.springframework.stereotype.Component; |
| 5 | + |
| 6 | +/** |
| 7 | + * Object storage configuration. The default keeps local development compatible |
| 8 | + * with the existing static upload directory; production should use S3. |
| 9 | + */ |
| 10 | +@Component |
| 11 | +@ConfigurationProperties(prefix = "storage") |
| 12 | +public class StorageProperties { |
| 13 | + |
| 14 | + private String provider = "local"; |
| 15 | + private String localRoot = "services/backend-api/src/main/resources/static/uploads"; |
| 16 | + private String publicBaseUrl = "/uploads"; |
| 17 | + private String s3Endpoint = ""; |
| 18 | + private String s3Region = "us-east-1"; |
| 19 | + private String s3Bucket = "kixi-images"; |
| 20 | + private String s3AccessKey = ""; |
| 21 | + private String s3SecretKey = ""; |
| 22 | + private boolean s3PathStyleAccess = true; |
| 23 | + private long maxObjectSizeBytes = 20L * 1024 * 1024; |
| 24 | + |
| 25 | + public String getProvider() { |
| 26 | + return provider; |
| 27 | + } |
| 28 | + |
| 29 | + public void setProvider(String provider) { |
| 30 | + this.provider = provider; |
| 31 | + } |
| 32 | + |
| 33 | + public String getLocalRoot() { |
| 34 | + return localRoot; |
| 35 | + } |
| 36 | + |
| 37 | + public void setLocalRoot(String localRoot) { |
| 38 | + this.localRoot = localRoot; |
| 39 | + } |
| 40 | + |
| 41 | + public String getPublicBaseUrl() { |
| 42 | + return publicBaseUrl; |
| 43 | + } |
| 44 | + |
| 45 | + public void setPublicBaseUrl(String publicBaseUrl) { |
| 46 | + this.publicBaseUrl = publicBaseUrl; |
| 47 | + } |
| 48 | + |
| 49 | + public String getS3Endpoint() { |
| 50 | + return s3Endpoint; |
| 51 | + } |
| 52 | + |
| 53 | + public void setS3Endpoint(String s3Endpoint) { |
| 54 | + this.s3Endpoint = s3Endpoint; |
| 55 | + } |
| 56 | + |
| 57 | + public String getS3Region() { |
| 58 | + return s3Region; |
| 59 | + } |
| 60 | + |
| 61 | + public void setS3Region(String s3Region) { |
| 62 | + this.s3Region = s3Region; |
| 63 | + } |
| 64 | + |
| 65 | + public String getS3Bucket() { |
| 66 | + return s3Bucket; |
| 67 | + } |
| 68 | + |
| 69 | + public void setS3Bucket(String s3Bucket) { |
| 70 | + this.s3Bucket = s3Bucket; |
| 71 | + } |
| 72 | + |
| 73 | + public String getS3AccessKey() { |
| 74 | + return s3AccessKey; |
| 75 | + } |
| 76 | + |
| 77 | + public void setS3AccessKey(String s3AccessKey) { |
| 78 | + this.s3AccessKey = s3AccessKey; |
| 79 | + } |
| 80 | + |
| 81 | + public String getS3SecretKey() { |
| 82 | + return s3SecretKey; |
| 83 | + } |
| 84 | + |
| 85 | + public void setS3SecretKey(String s3SecretKey) { |
| 86 | + this.s3SecretKey = s3SecretKey; |
| 87 | + } |
| 88 | + |
| 89 | + public boolean isS3PathStyleAccess() { |
| 90 | + return s3PathStyleAccess; |
| 91 | + } |
| 92 | + |
| 93 | + public void setS3PathStyleAccess(boolean s3PathStyleAccess) { |
| 94 | + this.s3PathStyleAccess = s3PathStyleAccess; |
| 95 | + } |
| 96 | + |
| 97 | + public long getMaxObjectSizeBytes() { |
| 98 | + return maxObjectSizeBytes; |
| 99 | + } |
| 100 | + |
| 101 | + public void setMaxObjectSizeBytes(long maxObjectSizeBytes) { |
| 102 | + this.maxObjectSizeBytes = maxObjectSizeBytes; |
| 103 | + } |
| 104 | +} |
0 commit comments