diff --git a/README.md b/README.md index fd141bc6..85b8588e 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Since Nx Cloud is a proprietary software from Narwhal Technologies Inc., it is h ## Project structure | Application/library | Summary | -|------------------------| ------------------------------------------------------------- | +|------------------------|---------------------------------------------------------------| | [`apps/api`](apps/api) | Backend of Nx Cloud CE, handles requests from Nx Cloud client | ## External Code and Licenses diff --git a/apps/api/src/main/kotlin/org/nxcloudce/api/storage/model/Bucket.kt b/apps/api/src/main/kotlin/org/nxcloudce/api/storage/model/Bucket.kt index 1b3bb78f..f022ffae 100644 --- a/apps/api/src/main/kotlin/org/nxcloudce/api/storage/model/Bucket.kt +++ b/apps/api/src/main/kotlin/org/nxcloudce/api/storage/model/Bucket.kt @@ -1,3 +1,3 @@ package org.nxcloudce.api.storage.model -data class Bucket(val name: String, val forcePathStyle: Boolean = false) +data class Bucket(val name: String) diff --git a/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Configuration.kt b/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Configuration.kt index e78022f9..e3bf7e53 100644 --- a/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Configuration.kt +++ b/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Configuration.kt @@ -1,6 +1,7 @@ package org.nxcloudce.api.storage.s3 import io.smallrye.config.ConfigMapping +import java.util.* @ConfigMapping(prefix = "nx-server.storage.s3") interface S3Configuration { @@ -14,5 +15,5 @@ interface S3Configuration { fun bucket(): String - fun forcePathStyle(): Boolean? + fun forcePathStyle(): Optional } diff --git a/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Producers.kt b/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Producers.kt index 9fc31d13..204e219e 100644 --- a/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Producers.kt +++ b/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Producers.kt @@ -16,7 +16,7 @@ class S3Producers { S3Client { endpointUrl = Url.parse(s3Configuration.endpoint()) region = s3Configuration.region() - forcePathStyle = s3Configuration.forcePathStyle() + forcePathStyle = s3Configuration.forcePathStyle().map { it }.orElse(null) credentialsProvider = StaticCredentialsProvider { accessKeyId = s3Configuration.accessKeyId() @@ -26,7 +26,7 @@ class S3Producers { @Produces @ApplicationScoped - fun bucket(s3Configuration: S3Configuration): Bucket = Bucket(s3Configuration.bucket(), s3Configuration.forcePathStyle() ?: false) + fun bucket(s3Configuration: S3Configuration): Bucket = Bucket(s3Configuration.bucket()) @Produces @ApplicationScoped diff --git a/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Repository.kt b/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Repository.kt index 859ededd..2d723361 100644 --- a/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Repository.kt +++ b/apps/api/src/main/kotlin/org/nxcloudce/api/storage/s3/S3Repository.kt @@ -23,10 +23,10 @@ class S3Repository( bucket = this@S3Repository.bucket.name key = objectPath } - return s3Client.presignGetObject( - getRequest, - presignExpiration, - ).url.toString() + return s3Client + .presignGetObject(getRequest, presignExpiration) + .url + .toString() } override suspend fun generatePutUrl(objectPath: String): String { @@ -35,9 +35,9 @@ class S3Repository( bucket = this@S3Repository.bucket.name key = objectPath } - return s3Client.presignPutObject( - putRequest, - presignExpiration, - ).url.toString() + return s3Client + .presignPutObject(putRequest, presignExpiration) + .url + .toString() } } diff --git a/apps/api/src/main/resources/application.yaml b/apps/api/src/main/resources/application.yaml index 99d2358e..d436368e 100644 --- a/apps/api/src/main/resources/application.yaml +++ b/apps/api/src/main/resources/application.yaml @@ -10,19 +10,20 @@ quarkus: api-key-parameter-name: authorization nx-server: - application-url: http://localhost:8080 client-bundle-version: 2402.02.12 client-bundle-path: static/client-bundle - storage: - s3: - endpoint: http://localhost:9000 - region: us-east-1 - access-key-id: nx-cloud-ce - secret-access-key: nx-cloud-ce - bucket: nx-cloud-ce - force-path-style: true "%dev": quarkus: mongodb: connection-string: mongodb://localhost:27017 + nx-server: + application-url: http://localhost:8080 + storage: + s3: + endpoint: http://localhost:9000 + region: us-east-1 + access-key-id: nx-cloud-ce + secret-access-key: nx-cloud-ce + bucket: nx-cloud-ce + force-path-style: true diff --git a/apps/api/src/test/resources/application.yaml b/apps/api/src/test/resources/application.yaml index efe42c35..c17e92c7 100644 --- a/apps/api/src/test/resources/application.yaml +++ b/apps/api/src/test/resources/application.yaml @@ -5,7 +5,7 @@ quarkus: s3: devservices: enabled: true - buckets: [nx-cloud-ce] + buckets: [ nx-cloud-ce ] nx-server: application-url: http://localtest diff --git a/compose.yaml b/compose.yaml index d1ff7b0a..15b5eabb 100644 --- a/compose.yaml +++ b/compose.yaml @@ -3,7 +3,7 @@ version: "3.8" services: mongo: image: mongo:7.0.5 - command: ["--replSet", "rs0", "--bind_ip_all", "--port", "27017"] + command: [ "--replSet", "rs0", "--bind_ip_all", "--port", "27017" ] ports: - 27017:27017 extra_hosts: @@ -21,7 +21,7 @@ services: mongo-express: image: mongo-express ports: - - '9500:9500' + - "9500:9500" environment: ME_CONFIG_MONGODB_URL: mongodb://mongo:27017/ PORT: 9500 @@ -31,13 +31,13 @@ services: environment: MINIO_ROOT_USER: nx-cloud-ce MINIO_ROOT_PASSWORD: nx-cloud-ce - MINIO_SERVER_URL: 'http://localhost:9000' - MINIO_STORAGE_USE_HTTPS: 'false' + MINIO_SERVER_URL: "http://localhost:9000" + MINIO_STORAGE_USE_HTTPS: "false" volumes: - minio-data:/data ports: - - '9000:9000' - - '9001:9001' + - "9000:9000" + - "9001:9001" volumes: mongo-config-data: