Skip to content

Commit

Permalink
Bugfix/#1706 cronjobconfiguration property of s3 integration mismatch (
Browse files Browse the repository at this point in the history
…#1812)

* #1706: rename de.muenchen.oss.digiwf.s3 / io.muenchendigital.digiwf.s3 to digiwf.s3

* #1706: rename de.muenchen.oss.digiwf.s3 to digiwf.s3 in S3IntegrationClientAutoConfiguration

* Update digiwf-integrations/digiwf-s3-integration/digiwf-s3-integration-service/src/main/resources/application.yml

Co-authored-by: markostreich <[email protected]>

* #1706: review feedback
  • Loading branch information
lehju authored Jul 4, 2024
1 parent 95cef7d commit d1174c6
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ digiwf:
s3service:
topic: 'dwf-s3-${DIGIWF_ENV}'
httpAPI: ${DIGIWF_S3_HTTPAPI:http://localhost:8086}
s3:
client:
document-storage-url: '${digiwf.s3service.httpAPI}'
enable-security: true
prometheus:
process-engine:
update-interval: 30000
Expand All @@ -199,12 +203,3 @@ io:
mail:
fromAddress: ${MAIL_USERNAME:[email protected]}

de:
muenchen:
oss:
digiwf:
s3:
client:
document-storage-url: '${digiwf.s3service.httpAPI}'
enable-security: true

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ io:
ssoTokenClientId: digitalwf
#ssoTokenRequestUrl:
#url:
s3:
client:
documentStorageUrl: http://localhost:8081

digiwf:
s3:
client:
documentStorageUrl: http://localhost:8081
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ io:
outputLanguage: Deutsch
keepFields: unresolved-ref

de:
muenchen:
oss:
digiwf:
s3:
client:
document-storage-url: '${DIGIWF_S3_HTTPAPI:http://localhost:8086}'
digiwf:
s3:
client:
document-storage-url: '${DIGIWF_S3_HTTPAPI:http://localhost:8086}'

management:
endpoint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ digiwf:
security:
client-id: ${SSO_DMS_CLIENT_ID}
client-secret: ${SSO_DMS_CLIENT_SECRET}
s3:
client:
document-storage-url: "${DOCUMENT_STORAGE_HOST:http://localhost}:${DOCUMENT_STORAGE_PORT:8080}"
enable-security: true

io:
muenchendigital:
Expand All @@ -73,10 +77,6 @@ de:
muenchen:
oss:
digiwf:
s3:
client:
document-storage-url: "${DOCUMENT_STORAGE_HOST:http://localhost}:${DOCUMENT_STORAGE_PORT:8080}"
enable-security: true
dms:
supported-file-extensions:
pdf: "application/pdf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

spring:
application:
name: "example client app"
Expand Down Expand Up @@ -51,15 +50,6 @@ spring:
client-secret: ${SSO_S3_CLIENT_SECRET}
scope: email, profile, openid # needed for userInfo endpoint

de:
muenchen:
oss:
digiwf:
s3:
client:
document-storage-url: ${DIGIWF_S3_HTTPAPI:http://localhost:8086}
enable-security: true # security is on and uses the "s3" client

io:
muenchendigital:
digiwf:
Expand All @@ -78,3 +68,7 @@ digiwf:
security:
client-id: ${SSO_S3_CLIENT_ID}
client-secret: ${SSO_S3_CLIENT_SECRET}
s3:
client:
document-storage-url: ${DIGIWF_S3_HTTPAPI:http://localhost:8086}
enable-security: true # security is on and uses the "s3" client
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ public void init() {
}

@Bean
@ConditionalOnProperty(prefix = "de.muenchen.oss.digiwf.s3.client", name = "enable-security", havingValue = "true")
@ConditionalOnProperty(prefix = "digiwf.s3.client", name = "enable-security", havingValue = "true")
public ApiClientFactory securedApiClientFactory(final ClientRegistrationRepository clientRegistrationRepository,
final OAuth2AuthorizedClientService authorizedClientService) {
final OAuth2AuthorizedClientService authorizedClientService) {
return new ApiClientFactory(
this.webClient(clientRegistrationRepository, authorizedClientService)
);
}

@Bean
@ConditionalOnProperty(prefix = "de.muenchen.oss.digiwf.s3.client", name = "enable-security", havingValue = "false", matchIfMissing = true)
@ConditionalOnProperty(prefix = "digiwf.s3.client", name = "enable-security", havingValue = "false", matchIfMissing = true)
public ApiClientFactory apiClientFactory() {
return new ApiClientFactory(
WebClient.builder().build()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.muenchen.oss.digiwf.s3.integration.client.properties;

import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
Expand All @@ -11,7 +10,7 @@
@Getter
@Setter
@Validated
@ConfigurationProperties(prefix = "de.muenchen.oss.digiwf.s3.client")
@ConfigurationProperties(prefix = "digiwf.s3.client")
public class S3IntegrationClientProperties {

private String documentStorageUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@ spring:
io:
muenchendigital:
digiwf:
s3:
bucketname: ${S3_BUCKETNAME}
accesskey: ${S3_ACCESSKEY}
url: ${S3_URL:http://localhost:9000}
secretkey: ${S3_SECRETKEY}
proxyUrl: "${S3_PROXY_HOST}:${S3_PROXY_PORT}"
cronjob:
cleanup:
unused-files: 0 15 10 16 * ?
expired-files: 0 15 10 15 * ?
proxyEnabled: 'false'
message:
incidentDestination: "dwf-connector-incident-${DIGIWF_ENV}"
bpmnErrorDestination: "dwf-connector-bpmnerror-${DIGIWF_ENV}"
Expand Down Expand Up @@ -79,3 +68,14 @@ digiwf:
security:
client-id: ${SSO_S3_CLIENT_ID}
client-secret: ${SSO_S3_CLIENT_SECRET}
s3:
bucket-name: ${S3_BUCKETNAME}
access-key: ${S3_ACCESSKEY}
url: ${S3_URL:http://localhost:9000}
secret-key: ${S3_SECRETKEY}
proxy-url: "${S3_PROXY_HOST}:${S3_PROXY_PORT}"
cronjob:
cleanup:
unused-files: 0 15 10 16 * ?
expired-files: 0 15 10 15 * ?
proxy-enabled: 'false'
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ spring:
sendMessage-out-0:
destination: dwf-connector-itest


io.muenchendigital.digiwf.s3:
digiwf.s3:
cleanupcronjob: "0 15 10 15 * ?"
url: s3k.muenchen.de
bucketName: int-dwfk-documentstoragelocal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spring:
hibernate:
format_sql: true

io.muenchendigital.digiwf.s3:
digiwf.s3:
cleanupcronjob: "0 15 10 15 * ?"
url: s3k.muenchen.de
bucketName: int-dwfk-documentstoragelocal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
@Configuration
@RequiredArgsConstructor
@ConditionalOnProperty(
prefix = "de.muenchen.oss.digiwf.s3.cronjob.cleanup",
name = {
"expired-files",
"unused-files"
}
prefix = "digiwf.s3.cronjob.cleanup",
name = {
"expired-files",
"unused-files"
}
)
public class CronJobConfiguration {

private final CleanUpExpiredFilesInPort cleanUpExpiredFiles;
private final CleanUpUnusedFoldersInPort cleanUpUnusedFolders;
private final CleanUpExpiredFilesInPort cleanUpExpiredFiles;
private final CleanUpUnusedFoldersInPort cleanUpUnusedFolders;

@Scheduled(cron = "${io.muenchendigital.digiwf.s3.cronjob.cleanup.expired-files}")
public void cronJobDefinitionCleanUpExpiredFolders() {
this.cleanUpExpiredFiles.cleanUpExpiredFolders();
}
@Scheduled(cron = "${digiwf.s3.cronjob.cleanup.expired-files}")
public void cronJobDefinitionCleanUpExpiredFolders() {
this.cleanUpExpiredFiles.cleanUpExpiredFolders();
}

@Scheduled(cron = "${io.muenchendigital.digiwf.s3.cronjob.cleanup.unused-files}")
public void cronJobCleanUpUnusedFolders() {
this.cleanUpUnusedFolders.cleanUpUnusedFolders();
}
@Scheduled(cron = "${digiwf.s3.cronjob.cleanup.unused-files}")
public void cronJobCleanUpUnusedFolders() {
this.cleanUpUnusedFolders.cleanUpUnusedFolders();
}

}

Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
package de.muenchen.oss.digiwf.s3.integration.properties;

import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;

import jakarta.validation.constraints.NotBlank;

@Getter
@Setter
@Validated
@ConfigurationProperties(prefix = "io.muenchendigital.digiwf.s3")
@ConfigurationProperties(prefix = "digiwf.s3")
public class S3IntegrationProperties {

@NotBlank
private String url;
@NotBlank
private String url;

@NotBlank
private String accessKey;
@NotBlank
private String accessKey;

@NotBlank
private String secretKey;
@NotBlank
private String secretKey;

@NotBlank
private String bucketName;
@NotBlank
private String bucketName;

private Boolean initialConnectionTest;
private Boolean initialConnectionTest;

private int presignedUrlExpiresInMinutes = 10080; // 7 days
private int presignedUrlExpiresInMinutes = 10080; // 7 days

private Boolean proxyEnabled = false;
private Boolean proxyEnabled = false;

private String proxyUrl;
private String proxyUrl;

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ digiwf:
client-secret: ${SSO_TICKET_CLIENT_SECRET}
zammad:
baseurl: ${TICKETING_ZAMMAD_URL}
s3:
client:
document-storage-url: "${DOCUMENT_STORAGE_HOST:http://localhost}:${DOCUMENT_STORAGE_PORT:8080}"
enable-security: true

feign:
client:
Expand Down Expand Up @@ -95,10 +99,6 @@ de:
muenchen:
oss:
digiwf:
s3:
client:
document-storage-url: "${DOCUMENT_STORAGE_HOST:http://localhost}:${DOCUMENT_STORAGE_PORT:8080}"
enable-security: true
ticketing:
supported-file-extensions:
pdf: "application/pdf"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ digiwf:
s3service:
topic: 'dwf-s3-${DIGIWF_ENV}'
httpAPI: ${DIGIWF_S3_HTTPAPI:http://localhost:8086}
s3:
client:
document-storage-url: '${digiwf.s3service.httpAPI}'
enable-security: true
security:
client-id: ${SSO_TASK_CLIENT_ID}
client-secret: ${SSO_TASK_CLIENT_SECRET}
Expand All @@ -130,15 +134,6 @@ digiwf:
url-template: "${MUCS_DMS_URL_TEMPLATE:https://eakte.muenchen.de/fsc/mx/{0}}"
label-template: "${MUCS_DMS_LABEL:MUCS DMS {0}}"

de:
muenchen:
oss:
digiwf:
s3:
client:
document-storage-url: '${digiwf.s3service.httpAPI}'
enable-security: true

management:
endpoint:
health:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ ezldap:
url: "http://localhost:${ezldap.client.port}"
request: "/test"

de:
muenchen:
oss:
digiwf:
s3:
client:
enable-security: false

digiwf:
s3service:
topic: 'dwf-s3-itest'
Expand All @@ -80,6 +72,9 @@ digiwf:
- link-type: mucsdms
url-template: "${MUCS_DMS_URL_TEMPLATE:https://eakte.muenchen.de/fsc/mx/{0}}"
label-template: "${MUCS_DMS_LABEL:MUCS DMS {0}}"
s3:
client:
enable-security: false

logging:
level:
Expand Down

0 comments on commit d1174c6

Please sign in to comment.