Skip to content

Commit

Permalink
Add 'radar.' prefix for storage properties
Browse files Browse the repository at this point in the history
  • Loading branch information
pvannierop committed Jul 8, 2024
1 parent 634e333 commit 92a8768
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.springframework.boot.context.properties.ConfigurationProperties;

@Data
@ConfigurationProperties("storage.s3")
@ConfigurationProperties("radar.storage.s3")
public class S3StorageProperties {
private String url;
private String accessKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*/
@CrossOrigin
@RestController
@ConditionalOnProperty(value = "file-upload.enabled", havingValue = "true")
@ConditionalOnProperty(value = "radar.file-upload.enabled", havingValue = "true")
@Slf4j
public class UploadController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import javax.annotation.PostConstruct;

@Component
@ConditionalOnExpression("${file-upload.enabled:false} and 's3' == '${storage.type:}'")
@ConditionalOnExpression("${radar.file-upload.enabled:false} and 's3' == '${radar.storage.type:}'")
public class MinioClientInitializer {

private transient MinioClient minioClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

@Slf4j
@Service
@ConditionalOnExpression("${file-upload.enabled:false} and 's3' == '${storage.type:}'")
@ConditionalOnExpression("${radar.file-upload.enabled:false} and 's3' == '${radar.storage.type:}'")
public class S3StorageService implements StorageService {

@Autowired
Expand Down
16 changes: 8 additions & 8 deletions src/main/resources/application-prod.properties
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ security.github.cache.duration=3600
security.github.cache.retryDuration=60

# DATA UPLOAD
file-upload.enabled=true
radar.file-upload.enabled=true
# Can be only 's3' at the moment.
storage.type=s3
storage.s3.url=http://localhost:9000
storage.s3.access-key=access-key
storage.s3.secret-key=secret-key
storage.s3.bucket-name=radar
radar.storage.type=s3
radar.storage.s3.url=http://localhost:9000
radar.storage.s3.access-key=access-key
radar.storage.s3.secret-key=secret-key
radar.storage.s3.bucket-name=radar
# Fixed prefix path in the output bucket (e.g., https://s3.amazonaws.com/bucket-name/<prefix>/subject-id/topic-id/...)
storage.s3.path.prefix=
radar.storage.s3.path.prefix=
# Collect uploaded files per day in a separate folder (e.g., https://s3.amazonaws.com/bucket-name/subject-id/topic-id/<20240220>/...)
storage.s3.path.collect-per-day=true
radar.storage.s3.path.collect-per-day=true
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@WebMvcTest(UploadController.class)
@AutoConfigureMockMvc(addFilters = false)
@TestPropertySource(properties = {
"file-upload.enabled=true",
"radar.file-upload.enabled=true",
"security.radar.managementportal.enabled=false"
})
class UploadControllerTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
@SpringBootTest(
classes = {S3StorageService.class},
properties = {
"file-upload.enabled=true",
"storage.type=s3",
"storage.s3.bucket-name=my-bucket",
"storage.s3.path.prefix=my-sub-path",
"radar.file-upload.enabled=true",
"radar.storage.type=s3",
"radar.storage.s3.bucket-name=my-bucket",
"radar.storage.s3.path.prefix=my-sub-path",
}
)
@EnableConfigurationProperties({S3StorageProperties.class})
Expand Down

0 comments on commit 92a8768

Please sign in to comment.