Skip to content

Commit 4bc54c4

Browse files
authored
Merge pull request #24 from TrueNine/dev
0.0.20
2 parents 1c43cb7 + 93211f5 commit 4bc54c4

File tree

10 files changed

+126
-134
lines changed

10 files changed

+126
-134
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ org-springframework-modulith = "2.0.0-M1"
5050
org-springframework-security = "6.5.2"
5151
org-testcontainers = "1.21.3"
5252
org-testng = "7.11.0"
53-
project = "0.0.19"
53+
project = "0.0.20"
5454

5555
[libraries]
5656
cn-dev33-sa-token-redis-jackson = { module = "cn.dev33:sa-token-redis-jackson", version.ref = "cn-dev33-sa-token" }

oss/oss-minio/src/main/kotlin/io/github/truenine/composeserver/oss/minio/properties/MinioProperties.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ private const val PREFIX = "compose.oss.minio"
2424
*/
2525
@ConfigurationProperties(prefix = PREFIX)
2626
data class MinioProperties(
27-
val endpoint: String = "127.0.0.1",
28-
val port: Int = 9000,
29-
val accessKey: String? = null,
30-
val secretKey: String? = null,
31-
val exposedBaseUrl: String? = null,
32-
val enableSsl: Boolean = false,
33-
val region: String? = null,
34-
val connectionTimeout: Duration = Duration.ofSeconds(30),
35-
val writeTimeout: Duration = Duration.ofMinutes(5),
36-
val readTimeout: Duration = Duration.ofMinutes(5),
37-
val enableLogging: Boolean = false,
27+
var endpoint: String = "127.0.0.1",
28+
var port: Int = 9000,
29+
var accessKey: String? = null,
30+
var secretKey: String? = null,
31+
var exposedBaseUrl: String? = null,
32+
var enableSsl: Boolean = false,
33+
var region: String? = null,
34+
var connectionTimeout: Duration = Duration.ofSeconds(30),
35+
var writeTimeout: Duration = Duration.ofMinutes(5),
36+
var readTimeout: Duration = Duration.ofMinutes(5),
37+
var enableLogging: Boolean = false,
3838
)

oss/oss-shared/src/main/kotlin/io/github/truenine/composeserver/oss/properties/OssProperties.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,49 +31,49 @@ private const val PREFIX = "compose.oss"
3131
@ConfigurationProperties(prefix = PREFIX)
3232
data class OssProperties(
3333
/** OSS provider type (minio, volcengine-tos, aliyun-oss, etc.) */
34-
val provider: String? = null,
34+
var provider: String? = null,
3535

3636
/** Service endpoint URL */
37-
val endpoint: String? = null,
37+
var endpoint: String? = null,
3838

3939
/** Service region */
40-
val region: String? = null,
40+
var region: String? = null,
4141

4242
/** Access key for authentication */
43-
val accessKey: String? = null,
43+
var accessKey: String? = null,
4444

4545
/** Secret key for authentication */
46-
val secretKey: String? = null,
46+
var secretKey: String? = null,
4747

4848
/** Public base URL for object access */
49-
val exposedBaseUrl: String? = null,
49+
var exposedBaseUrl: String? = null,
5050

5151
/** Enable SSL/TLS connection */
52-
val enableSsl: Boolean = true,
52+
var enableSsl: Boolean = true,
5353

5454
/** Connection timeout */
55-
val connectionTimeout: Duration = Duration.ofSeconds(30),
55+
var connectionTimeout: Duration = Duration.ofSeconds(30),
5656

5757
/** Read timeout */
58-
val readTimeout: Duration = Duration.ofMinutes(5),
58+
var readTimeout: Duration = Duration.ofMinutes(5),
5959

6060
/** Write timeout */
61-
val writeTimeout: Duration = Duration.ofMinutes(5),
61+
var writeTimeout: Duration = Duration.ofMinutes(5),
6262

6363
/** Maximum number of connections */
64-
val maxConnections: Int = 100,
64+
var maxConnections: Int = 100,
6565

6666
/** Default bucket name */
67-
val defaultBucket: String? = null,
67+
var defaultBucket: String? = null,
6868

6969
/** Auto create bucket if not exists */
70-
val autoCreateBucket: Boolean = false,
70+
var autoCreateBucket: Boolean = false,
7171

7272
/** Enable object versioning */
73-
val enableVersioning: Boolean = false,
73+
var enableVersioning: Boolean = false,
7474

7575
/** Enable request/response logging */
76-
val enableLogging: Boolean = false,
76+
var enableLogging: Boolean = false,
7777
) {
7878
/**
7979
* Validate the configuration properties

oss/oss-volcengine-tos/src/main/kotlin/io/github/truenine/composeserver/oss/volcengine/properties/VolcengineTosProperties.kt

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,94 +44,94 @@ private const val PREFIX = "compose.oss.volcengine-tos"
4444
@ConfigurationProperties(prefix = PREFIX)
4545
data class VolcengineTosProperties(
4646
/** Service endpoint URL */
47-
val endpoint: String? = null,
47+
var endpoint: String? = null,
4848

4949
/** Service region */
50-
val region: String? = null,
50+
var region: String? = null,
5151

5252
/** Access key for authentication */
53-
val accessKey: String? = null,
53+
var accessKey: String? = null,
5454

5555
/** Secret key for authentication */
56-
val secretKey: String? = null,
56+
var secretKey: String? = null,
5757

5858
/** Session token for temporary credentials (STS) */
59-
val sessionToken: String? = null,
59+
var sessionToken: String? = null,
6060

6161
/** Public base URL for object access */
62-
val exposedBaseUrl: String? = null,
62+
var exposedBaseUrl: String? = null,
6363

6464
/** Enable SSL/TLS connection */
65-
val enableSsl: Boolean = true,
65+
var enableSsl: Boolean = true,
6666

6767
// === Timeout Configuration ===
6868
/** Connection timeout in milliseconds - optimized for production */
69-
val connectTimeoutMills: Int = 10_000,
69+
var connectTimeoutMills: Int = 10_000,
7070

7171
/** Read timeout in milliseconds - balanced for large files */
72-
val readTimeoutMills: Int = 60_000,
72+
var readTimeoutMills: Int = 60_000,
7373

7474
/** Write timeout in milliseconds - balanced for large uploads */
75-
val writeTimeoutMills: Int = 60_000,
75+
var writeTimeoutMills: Int = 60_000,
7676

7777
/** Idle connection timeout in milliseconds - connection pool optimization */
78-
val idleConnectionTimeMills: Int = 60_000,
78+
var idleConnectionTimeMills: Int = 60_000,
7979

8080
// === Connection Pool Configuration ===
8181
/** Maximum number of connections in pool - optimized for high concurrency */
82-
val maxConnections: Int = 1024,
82+
var maxConnections: Int = 1024,
8383

8484
/** Maximum number of retries on failure - balanced retry strategy */
85-
val maxRetryCount: Int = 3,
85+
var maxRetryCount: Int = 3,
8686

8787
/** DNS cache time in minutes - 0 means disabled, positive values enable caching */
88-
val dnsCacheTimeMinutes: Int = 5,
88+
var dnsCacheTimeMinutes: Int = 5,
8989

9090
// === Feature Toggles ===
9191
/** Enable CRC64 checksum validation for data integrity */
92-
val enableCrc: Boolean = true,
92+
var enableCrc: Boolean = true,
9393

9494
/** Enable SSL certificate verification */
95-
val enableVerifySSL: Boolean = true,
95+
var enableVerifySSL: Boolean = true,
9696

9797
/** Auto recognize content type by file extension */
98-
val clientAutoRecognizeContentType: Boolean = true,
98+
var clientAutoRecognizeContentType: Boolean = true,
9999

100100
/** Enable detailed request/response logging */
101-
val enableLogging: Boolean = false,
101+
var enableLogging: Boolean = false,
102102

103103
// === Domain Configuration ===
104104
/** Custom domain for object access */
105-
val customDomain: String? = null,
105+
var customDomain: String? = null,
106106

107107
/** Whether using custom domain (affects bucket name handling) */
108-
val isCustomDomain: Boolean = false,
108+
var isCustomDomain: Boolean = false,
109109

110110
// === User-Agent Configuration ===
111111
/** Product name for User-Agent header */
112-
val userAgentProductName: String = "ComposeServer",
112+
var userAgentProductName: String = "ComposeServer",
113113

114114
/** Software name for User-Agent header */
115-
val userAgentSoftName: String = "TOS-Client",
115+
var userAgentSoftName: String = "TOS-Client",
116116

117117
/** Software version for User-Agent header */
118-
val userAgentSoftVersion: String = "1.0.0",
118+
var userAgentSoftVersion: String = "1.0.0",
119119

120120
/** Custom key-value pairs for User-Agent */
121-
val userAgentCustomizedKeyValues: Map<String, String> = emptyMap(),
121+
var userAgentCustomizedKeyValues: Map<String, String> = emptyMap(),
122122

123123
// === Proxy Configuration ===
124124
/** Proxy server host */
125-
val proxyHost: String? = null,
125+
var proxyHost: String? = null,
126126

127127
/** Proxy server port */
128-
val proxyPort: Int = 0,
128+
var proxyPort: Int = 0,
129129

130130
/** Proxy authentication username */
131-
val proxyUserName: String? = null,
131+
var proxyUserName: String? = null,
132132

133133
/** Proxy authentication password */
134-
val proxyPassword: String? = null,
134+
var proxyPassword: String? = null,
135135
) {
136136

137137
/** Validate configuration properties */

shared/src/main/kotlin/io/github/truenine/composeserver/holders/config/ResourceHolderConfiguration.kt

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,34 @@ import org.springframework.validation.annotation.Validated
2424
data class ResourceHolderConfiguration(
2525

2626
// Basic configuration (backward compatibility)
27-
@field:NotBlank(message = "Config location cannot be blank") val configLocation: String = "config",
28-
@field:NotBlank(message = "Data location cannot be blank") val location: String = "data",
29-
@field:NotEmpty(message = "Match files list cannot be empty") val matchFiles: MutableList<String> = mutableListOf(),
27+
@field:NotBlank(message = "Config location cannot be blank") var configLocation: String = "config",
28+
@field:NotBlank(message = "Data location cannot be blank") var location: String = "data",
29+
@field:NotEmpty(message = "Match files list cannot be empty") var matchFiles: MutableList<String> = mutableListOf(),
3030

3131
// Enhanced configuration
3232
/** Active profiles for environment-specific resource resolution. Resources with matching profiles take precedence over default resources. */
33-
val activeProfiles: List<String> = emptyList(),
33+
var activeProfiles: List<String> = emptyList(),
3434

3535
/** Custom resource sources with explicit priorities. These sources are added to the default Spring Boot-like hierarchy. */
36-
val customSources: List<CustomResourceSource> = emptyList(),
36+
var customSources: List<CustomResourceSource> = emptyList(),
3737

3838
/** Cache configuration for performance optimization. */
39-
val cache: CacheConfiguration = CacheConfiguration(),
39+
var cache: CacheConfiguration = CacheConfiguration(),
4040

4141
/** Whether to enable strict mode for resource resolution. In strict mode, missing required resources will cause startup failure. */
42-
val strictMode: Boolean = false,
42+
var strictMode: Boolean = false,
4343

4444
/** Whether to enable resource change detection and automatic cache invalidation. */
45-
val enableChangeDetection: Boolean = false,
45+
var enableChangeDetection: Boolean = false,
4646

4747
/** Timeout in milliseconds for resource resolution operations. */
48-
@field:Min(value = 1000, message = "Resolution timeout must be at least 1000ms") val resolutionTimeoutMs: Long = 30000,
48+
@field:Min(value = 1000, message = "Resolution timeout must be at least 1000ms") var resolutionTimeoutMs: Long = 30000,
4949

5050
/** Whether to enable detailed logging for resource resolution debugging. */
51-
val enableDebugLogging: Boolean = false,
51+
var enableDebugLogging: Boolean = false,
5252

5353
/** Fallback configuration for when resources are not found. */
54-
val fallback: FallbackConfiguration = FallbackConfiguration(),
54+
var fallback: FallbackConfiguration = FallbackConfiguration(),
5555
) {
5656

5757
/** Gets the primary active profile (first in the list). */
@@ -73,11 +73,11 @@ data class ResourceHolderConfiguration(
7373

7474
/** Configuration for custom resource sources. */
7575
data class CustomResourceSource(
76-
@field:NotBlank(message = "Resource source type cannot be blank") val type: String,
77-
@field:NotBlank(message = "Resource source path cannot be blank") val path: String,
78-
@field:Min(value = 0, message = "Priority must be non-negative") val priority: Int,
79-
val profile: String? = null,
80-
val description: String = "",
76+
@field:NotBlank(message = "Resource source type cannot be blank") var type: String,
77+
@field:NotBlank(message = "Resource source path cannot be blank") var path: String,
78+
@field:Min(value = 0, message = "Priority must be non-negative") var priority: Int,
79+
var profile: String? = null,
80+
var description: String = "",
8181
) {
8282

8383
/** Converts to ResourceSource. */
@@ -104,47 +104,47 @@ data class CustomResourceSource(
104104
/** Cache configuration for resource resolution. */
105105
data class CacheConfiguration(
106106
/** Whether caching is enabled. */
107-
val enabled: Boolean = true,
107+
var enabled: Boolean = true,
108108

109109
/** Maximum number of entries in the cache. */
110-
@field:Min(value = 10, message = "Cache max size must be at least 10") val maxSize: Int = 1000,
110+
@field:Min(value = 10, message = "Cache max size must be at least 10") var maxSize: Int = 1000,
111111

112112
/** Time-to-live for cache entries in milliseconds. */
113-
@field:Min(value = 1000, message = "Cache TTL must be at least 1000ms") val ttlMs: Long = 300_000, // 5 minutes
113+
@field:Min(value = 1000, message = "Cache TTL must be at least 1000ms") var ttlMs: Long = 300_000, // 5 minutes
114114

115115
/** Whether to enable cache statistics collection. */
116-
val enableStats: Boolean = true,
116+
var enableStats: Boolean = true,
117117

118118
/** Interval in milliseconds for automatic cleanup of expired entries. */
119-
@field:Min(value = 10000, message = "Cleanup interval must be at least 10000ms") val cleanupIntervalMs: Long = 60_000, // 1 minute
119+
@field:Min(value = 10000, message = "Cleanup interval must be at least 10000ms") var cleanupIntervalMs: Long = 60_000, // 1 minute
120120
)
121121

122122
/** Fallback configuration for resource resolution. */
123123
data class FallbackConfiguration(
124124
/** Whether to enable fallback to default resources when profile-specific resources are not found. */
125-
val enableProfileFallback: Boolean = true,
125+
var enableProfileFallback: Boolean = true,
126126

127127
/** Whether to enable fallback to classpath resources when filesystem resources are not found. */
128-
val enableClasspathFallback: Boolean = true,
128+
var enableClasspathFallback: Boolean = true,
129129

130130
/** Default resource patterns to use as fallbacks. */
131-
val defaultPatterns: List<String> = emptyList(),
131+
var defaultPatterns: List<String> = emptyList(),
132132

133133
/** Whether to create empty resources when no fallbacks are available. */
134-
val createEmptyResources: Boolean = false,
134+
var createEmptyResources: Boolean = false,
135135
)
136136

137137
/** Validation configuration for resource patterns and sources. */
138138
data class ValidationConfiguration(
139139
/** Whether to validate resource patterns for security (e.g., prevent path traversal). */
140-
val enablePatternValidation: Boolean = true,
140+
var enablePatternValidation: Boolean = true,
141141

142142
/** Whether to validate that configured resource sources are accessible at startup. */
143-
val enableSourceValidation: Boolean = true,
143+
var enableSourceValidation: Boolean = true,
144144

145145
/** List of allowed resource patterns (regex). */
146-
val allowedPatterns: List<String> = listOf(".*"),
146+
var allowedPatterns: List<String> = listOf(".*"),
147147

148148
/** List of forbidden resource patterns (regex). */
149-
val forbiddenPatterns: List<String> = listOf(".*\\.\\./.*"), // Prevent path traversal
149+
var forbiddenPatterns: List<String> = listOf(".*\\.\\./.*"), // Prevent path traversal
150150
)

shared/src/main/kotlin/io/github/truenine/composeserver/holders/config/ResourceSource.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver
1919
* @author TrueNine
2020
* @since 2024-07-18
2121
*/
22-
data class ResourceSource(val type: ResourceType, val path: String, val priority: Int, val profile: String? = null, val description: String = "") {
22+
data class ResourceSource(var type: ResourceType, var path: String, var priority: Int, var profile: String? = null, var description: String = "") {
2323

2424
init {
2525
if (!path.hasText()) {

shared/src/main/kotlin/io/github/truenine/composeserver/properties/DataLoadProperties.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ private const val PREFIX = "compose.shared"
2020
*/
2121
@ConfigurationProperties(prefix = "$PREFIX.data-load")
2222
data class DataLoadProperties(
23-
val location: String = "data",
24-
val matchFiles: MutableList<String> = mutableListOf(),
25-
val configLocation: String = "config",
23+
var location: String = "data",
24+
var matchFiles: MutableList<String> = mutableListOf(),
25+
var configLocation: String = "config",
2626

2727
/** Enhanced configuration properties for advanced ResourceHolder features. This provides access to profile-based resolution, caching, custom sources, etc. */
2828
@NestedConfigurationProperty
29-
val enhanced: ResourceHolderConfiguration = ResourceHolderConfiguration(configLocation = configLocation, location = location, matchFiles = matchFiles),
29+
var enhanced: ResourceHolderConfiguration = ResourceHolderConfiguration(configLocation = configLocation, location = location, matchFiles = matchFiles),
3030
) {
3131

3232
/** Gets the effective configuration location, preferring enhanced config if available. */

0 commit comments

Comments
 (0)