diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 000000000..7760089f0 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,58 @@ +name: Docker build + +on: + push: + branches: [ "develop" ] + workflow_dispatch: + workflow_call: + +jobs: + build: + runs-on: self-hosted + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Build Marketplace service project + run: | + cd ./marketplace-service + mvn clean install -DskipTests + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + cache-dependency-path: ./marketplace-ui/package-lock.json + - name: Build Marketplace ui project + run: | + cd ./marketplace-ui + npm i + npm run build --prod + - name: Update environment variables for ENV + env: + ENV_FILE: './marketplace-build/.env' + MONGODB_HOST: ${{ secrets.MONGODB_HOST }} + ROOT_USERNAME: ${{ secrets.MONGODB_ROOT_USERNAME }} + ROOT_PASSWORD: ${{ secrets.MONGODB_ROOT_PASSWORD }} + SERVICE_USERNAME: ${{ secrets.SERVICE_USERNAME }} + SERVICE_PASSWORD: ${{ secrets.SERVICE_PASSWORD }} + MONGODB_DATABASE: ${{ secrets.MONGODB_DATABASE }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + sed -i "s/^MONGODB_INITDB_ROOT_USERNAME=.*$/MONGODB_INITDB_ROOT_USERNAME=$ROOT_USERNAME/" $ENV_FILE + sed -i "s/^MONGODB_INITDB_ROOT_PASSWORD=.*$/MONGODB_INITDB_ROOT_PASSWORD=$ROOT_PASSWORD/" $ENV_FILE + sed -i "s/^SERVICE_MONGODB_HOST=.*$/SERVICE_MONGODB_HOST=$MONGODB_HOST/" $ENV_FILE + sed -i "s/^SERVICE_MONGODB_DATABASE=.*$/SERVICE_MONGODB_DATABASE=$MONGODB_DATABASE/" $ENV_FILE + sed -i "s/^SERVICE_MONGODB_USER=.*$/SERVICE_MONGODB_USER=$SERVICE_USERNAME/" $ENV_FILE + sed -i "s/^SERVICE_MONGODB_PASSWORD=.*$/SERVICE_MONGODB_PASSWORD=$SERVICE_PASSWORD/" $ENV_FILE + sed -i "s/^MARKET_GITHUB_TOKEN=.*$/MARKET_GITHUB_TOKEN=$GH_TOKEN/" $ENV_FILE + + - name: Refresh Docker images + working-directory: ./marketplace-build + run: | + docker compose down + docker compose -f docker-compose.yml up -d diff --git a/.github/workflows/docker-compose-build.yml b/.github/workflows/docker-compose-build.yml deleted file mode 100644 index 51d111de6..000000000 --- a/.github/workflows/docker-compose-build.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Run Docker compose up - -on: - push: - branches: [ "develop" ] - workflow_dispatch: - -jobs: - build: - #runs-on: self-hosted - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - cache: maven - - name: Update configuration - env: - ENV_FILE: './marketplace-build/.env' - MONGODB_HOST: ${{ secrets.MONGODB_HOST }} - MONGODB_DATABASE: ${{ secrets.MONGODB_DATABASE }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - run: | - sed -i "s/^MONGODB_INITDB_ROOT_USERNAME=.*$/spring.data.mongodb.host=$MONGODB_HOST/" $ENV_FILE - sed -i "s/^MONGODB_INITDB_ROOT_PASSWORD=.*$/spring.data.mongodb.database=$MONGODB_DATABASE/" $ENV_FILE - sed -i "s/^SERVICE_MONGODB_HOST=.*$/spring.data.mongodb.database=$MONGODB_DATABASE/" $ENV_FILE - sed -i "s/^SERVICE_MONGODB_DATABASE=.*$/spring.data.mongodb.database=$MONGODB_DATABASE/" $ENV_FILE - sed -i "s/^SERVICE_MONGODB_USER=.*$/spring.data.mongodb.database=$MONGODB_DATABASE/" $ENV_FILE - sed -i "s/^SERVICE_MONGODB_PASSWORD=.*$/spring.data.mongodb.database=$MONGODB_DATABASE/" $ENV_FILE - - - name: Build and push Docker images - working-directory: ./marketplace-build - run: | - docker-compose -f docker-compose.yml up -d diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 000000000..854276579 --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,46 @@ +name: Docker Release + +on: + push: + branches: [ "master" ] + workflow_dispatch: + +env: + UI_IMAGE_NAME: marketplace-ui + SERVICE_IMAGE_NAME: marketplace-service + +jobs: + + build: + uses: ./.github/workflows/docker-build.yml + + release: + needs: build + runs-on: self-hosted + permissions: + packages: write + contents: read + + steps: + - name: Log in to registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Refine release version + run: | + # This strips the git ref prefix from the version. + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # This strips the "v" prefix from the tag name. + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # This uses the Docker `latest` tag convention. + [ "$VERSION" == "main" ] && VERSION=latest + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Release Marketplace UI image + run: | + UI_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$UI_IMAGE_NAME + docker tag $UI_IMAGE_NAME $UI_IMAGE_ID:$VERSION + docker push $UI_IMAGE_ID:$VERSION + + - name: Release Marketplace Service image + run: | + SERVICE_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$SERVICE_IMAGE_NAME + docker tag $SERVICE_IMAGE_NAME $SERVICE_IMAGE_ID:$VERSION + docker push $SERVICE_IMAGE_ID:$VERSION \ No newline at end of file diff --git a/.github/workflows/service-ci-build.yml b/.github/workflows/service-ci-build.yml index e384445d2..ef121541e 100644 --- a/.github/workflows/service-ci-build.yml +++ b/.github/workflows/service-ci-build.yml @@ -3,6 +3,8 @@ run-name: Build Service on branch ${{github.ref_name}} triggered by ${{github.ac on: push: + paths: + - 'marketplace-service/**' workflow_dispatch: jobs: diff --git a/.github/workflows/service-dev-build.yml b/.github/workflows/service-dev-build.yml deleted file mode 100644 index e310a9378..000000000 --- a/.github/workflows/service-dev-build.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Service DEV Build -run-name: Build and Deploy Marketplace-Service on branch ${{github.ref_name}} by ${{github.actor}} - -on: - push: - branches: [ "develop" ] - workflow_dispatch: - -jobs: - build: - name: Packge project and deploy to tomcat - runs-on: self-hosted - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - cache: maven - - name: Update configuration - env: - APP_PROPERTIES_FILE: './marketplace-service/src/main/resources/application.properties' - GITHUB_TOKEN_FILE: './marketplace-service/src/main/resources/github.token' - MONGODB_HOST: ${{ secrets.MONGODB_HOST }} - MONGODB_DATABASE: ${{ secrets.MONGODB_DATABASE }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} - run: | - sed -i "s/^spring.data.mongodb.host=.*$/spring.data.mongodb.host=$MONGODB_HOST/" $APP_PROPERTIES_FILE - sed -i "s/^spring.data.mongodb.database=.*$/spring.data.mongodb.database=$MONGODB_DATABASE/" $APP_PROPERTIES_FILE - sed -i '1d;$d' $GITHUB_TOKEN_FILE && echo $GH_TOKEN > $GITHUB_TOKEN_FILE - - name: Build with Maven - run: mvn clean package -DskipTests --file ./marketplace-service/pom.xml - - name: Prepare deployment directory - run: mkdir -p deployment && cp ./marketplace-service/target/*.war deployment/ - - name: Copy WAR to Tomcat server - run: sudo cp deployment/*.war /opt/tomcat/webapps/marketplace-service.war - - name: Restart Tomcat server - run: | - sudo systemctl stop tomcat - sudo systemctl start tomcat diff --git a/.github/workflows/ui-ci-build.yml b/.github/workflows/ui-ci-build.yml index 8137daf8b..ea3b727ec 100644 --- a/.github/workflows/ui-ci-build.yml +++ b/.github/workflows/ui-ci-build.yml @@ -3,9 +3,8 @@ run-name: Build on branch ${{github.ref_name}} triggered by ${{github.actor}} on: push: - branches-ignore: - - develop - - master + paths: + - 'marketplace-ui/**' workflow_dispatch: jobs: diff --git a/.github/workflows/ui-dev-build.yml b/.github/workflows/ui-dev-build.yml deleted file mode 100644 index 506278838..000000000 --- a/.github/workflows/ui-dev-build.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: UI Dev Build -run-name: Build and Deploy Marketplace-UI on branch ${{github.ref_name}} by ${{github.actor}} - -on: - push: - branches: [ "develop" ] - workflow_dispatch: - -jobs: - build: - name: Build and deploy new code to Deployment directory - runs-on: self-hosted - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '18' - cache: 'npm' - - name: Install Dependencies - run: npm install - - name: Build Angular app - run: npm run build -- --configuration production --output-path=dist - - name: Execute Tests - run: npm run test - - name: Copy files to Deployment directory - if: success() - run: sudo cp -r dist/* /var/www/marketplace-ui diff --git a/README.md b/README.md index 4d546f33a..5ef75bcd7 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,17 @@ # Getting Started -### Reference Documentation -For further reference, please consider the following sections: - -* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) -* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.5/maven-plugin/reference/html/) -* [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/3.2.5/reference/htmlsingle/index.html#data.nosql.mongodb) -* [Spring Web](https://docs.spring.io/spring-boot/docs/3.2.5/reference/htmlsingle/index.html#web) +For AxonIvy Marketplace, we have 3 parts: marketplace-ui, marketplace-service, and marketplace-build: +* ``marketplace-ui``: is an Angular project, built on v18 and contains the frontend code for the website. +* ``marketplace-service``: is a SpringBoot project, built on v3.2.5 and includes the apis code for the website. +* ``marketplace-build``: is a folder to keep everything related to build and dockers. ### Guides -The following guides illustrate how to use some features concretely: - -* Installing mongodb, and access it as Url mongodb://localhost:27017/, and you can create and name whatever you want ,then you should put them to application.properties -* You can change the MongoDB configuration in file `application.properties` - ``` - spring.data.mongodb.host= - spring.data.mongodb.database= - ``` -* Update GitHub token in file `github.token` -* Run mvn clean install to build project -* Run mvn test to test all tests +* How to start the Marketplace UI refer to the [marketplace-ui guide][1] +* How to start the Marketplace Service refer to the [marketplace-service guide][2] -### Access Swagger URL: http://{your-host}/swagger-ui/index.html +* How to start the Marketplace Build refer to the [marketplace-build guide][3] -### Install Lombok for Eclipse IDE -* Download lombok here https://projectlombok.org/download -* run command "java -jar lombok.jar" then you can access file “eclipse.ini“ in eclipse folder where you install → there is a text like this: -javaagent:C:\Users\tvtphuc\eclipse\jee-2024-032\eclipse\lombok.jar → it means you are successful -* Start eclipse -* Import the project then in the eclipse , you should run the command “mvn clean install“ -* After that you go to class MarketplaceServiceApplication → right click to main method → click run as → choose Java Application -* Then you can send a request in postman -* If you want to run single test in class UserServiceImplTest. You can right-click to method testFindAllUser and right click → select Run as → choose JUnit Test \ No newline at end of file + [1]: marketplace-ui/README.md + [2]: marketplace-service/README.md + [3]: marketplace-build/README.md diff --git a/marketplace-build/.env b/marketplace-build/.env index 14ed8770f..e2ca21cd2 100644 --- a/marketplace-build/.env +++ b/marketplace-build/.env @@ -1,4 +1,7 @@ MONGODB_INITDB_ROOT_USERNAME= MONGODB_INITDB_ROOT_PASSWORD= +SERVICE_MONGODB_HOST= SERVICE_MONGODB_USER= SERVICE_MONGODB_PASSWORD= +SERVICE_MONGODB_DATABASE= +MARKET_GITHUB_TOKEN= \ No newline at end of file diff --git a/marketplace-build/Dockerfile-NGINX b/marketplace-build/Dockerfile-NGINX deleted file mode 100644 index 93bfec627..000000000 --- a/marketplace-build/Dockerfile-NGINX +++ /dev/null @@ -1,10 +0,0 @@ -# use the latest version of the official nginx image as the base image -FROM nginx:latest -# copy the custom nginx configuration file to the container in the -# default location -COPY ./config/nginx/nginx.conf /etc/nginx/nginx.conf -# copy the built Angular app files to the default nginx html directory -#COPY /dist/browser /usr/share/nginx/html -COPY --from=assets browser /usr/share/nginx/html - -# the paths are relative from the Docker file diff --git a/marketplace-build/Dockerfile-UI b/marketplace-build/Dockerfile-UI index eab1641c4..93bfec627 100644 --- a/marketplace-build/Dockerfile-UI +++ b/marketplace-build/Dockerfile-UI @@ -1,13 +1,10 @@ -# Stage 2: Serve the Angular application with Nginx -FROM nginx:alpine - -# Copy the built Angular application from the previous stage -COPY --from=assets browser /usr/share/nginx/html - +# use the latest version of the official nginx image as the base image +FROM nginx:latest +# copy the custom nginx configuration file to the container in the +# default location COPY ./config/nginx/nginx.conf /etc/nginx/nginx.conf +# copy the built Angular app files to the default nginx html directory +#COPY /dist/browser /usr/share/nginx/html +COPY --from=assets browser /usr/share/nginx/html -# Expose port 80 -EXPOSE 80 - -# Start Nginx server -CMD ["nginx", "-g", "daemon off;"] +# the paths are relative from the Docker file diff --git a/marketplace-build/Marketplace Tomcat v10.1 Server.launch b/marketplace-build/Marketplace Tomcat v10.1 Server.launch index 5e4b64925..e3efb4803 100644 --- a/marketplace-build/Marketplace Tomcat v10.1 Server.launch +++ b/marketplace-build/Marketplace Tomcat v10.1 Server.launch @@ -2,8 +2,9 @@ - - + + + diff --git a/marketplace-build/README.md b/marketplace-build/README.md new file mode 100644 index 000000000..9d2da125b --- /dev/null +++ b/marketplace-build/README.md @@ -0,0 +1,51 @@ +# Get starts with Marketplace build + +### Set up MongoDB with authentication mode +* Navigate to ``marketplace-build/config/mongodb`` and execute the ``docker-compose up`` to start MongoDB with non-auth mode +* Create root user for authentication + ``` + use admin + db.createUser( + { + user: "username", + pwd: "password", + roles: [ + { role: "userAdminAnyDatabase", db: "admin" }, + { role: "readWriteAnyDatabase", db: "admin" } + ] + } + ) + + db.grantRolesToUser('username', [{ role: 'root', db: 'admin' }]) + ``` + +* [Optional] Execute authentication test for the created user + ``` + use admin + db.auth('username','password') + ``` +This command should return the ``OK`` code + +### Docker build for DEV environment +* Navigate to ``marketplace-service`` and execute maven build for spring-boot app to get the war file: + ``` + mvn clean install -DskipTests + ``` + +* Navigate to ``marketplace-ui`` and execute node install and run the angular app to get the dist folder: + ``` + npm instal + npm run build --prod + ``` + +* Please run ``docker-compose up --build`` from folder ``marketplace-build`` to start a Marketplace DEV at the local + +### Docker release +To release a new version for marketplace images, please trigger the ``Docker Release`` actions. +* This GH Actions will trigger the ``Docker build`` on the master branch. +* Login to GitHub Registry Hub. +* Deploy new image to packages. +Please verify the result in the ``Package`` after the build is completed. + +### Docker compose for PROD deployment +* Navigate to ``marketplace-build/release`` run ``docker-compose up`` to clone the docker images from GitHub packages and start the website diff --git a/marketplace-build/config/mongodb/docker-compose.yml b/marketplace-build/config/mongodb/docker-compose.yml index 17dc83b6e..ddfb3acb0 100644 --- a/marketplace-build/config/mongodb/docker-compose.yml +++ b/marketplace-build/config/mongodb/docker-compose.yml @@ -1,17 +1,14 @@ +# This docker compose to init mongo for setup auth +name: marketplace + services: mongodb: image: mongodb/mongodb-community-server:7.0.0-ubi8 - container_name: mongodb-7.0.0 restart: always ports: - "27017:27017" volumes: - mongodata:/data/db - environment: - - MONGODB_INITDB_ROOT_USERNAME= - - MONGODB_INITDB_ROOT_PASSWORD= - - ./mongod.conf:/etc/mongod.conf - command: ["mongod", "--config", "/etc/mongod.conf"] volumes: - mongodata: \ No newline at end of file + mongodata: diff --git a/marketplace-build/config/tomcat/web.xml b/marketplace-build/config/tomcat/web.xml deleted file mode 100644 index 05d0a570b..000000000 --- a/marketplace-build/config/tomcat/web.xml +++ /dev/null @@ -1,32 +0,0 @@ - - CorsFilter - org.apache.catalina.filters.CorsFilter - - cors.allowed.origins - * - - - cors.allowed.methods - GET,POST,HEAD,OPTIONS,PUT - - - cors.allowed.headers - Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers - - - cors.exposed.headers - Access-Control-Allow-Origin,Access-Control-Allow-Credentials - - - cors.support.credentials - true - - - cors.preflight.maxage - 10 - - - - CorsFilter - /* - \ No newline at end of file diff --git a/marketplace-build/docker-compose.yml b/marketplace-build/docker-compose.yml index b0993f220..ecc39822f 100644 --- a/marketplace-build/docker-compose.yml +++ b/marketplace-build/docker-compose.yml @@ -3,7 +3,7 @@ name: marketplace services: mongodb: image: mongodb/mongodb-community-server:7.0.0-ubi8 - container_name: mongodb-7.0.0 + container_name: marketplace-mongodb-7.0.0 restart: always ports: - "27017:27017" @@ -15,34 +15,41 @@ services: - ./config/mongodb/mongod.conf:/etc/mongod.conf command: ["mongod", "--config", "/etc/mongod.conf"] - nginx: + ui: build: context: . additional_contexts: assets: ../marketplace-ui/dist/ - dockerfile: Dockerfile-NGINX + dockerfile: Dockerfile-UI restart: always volumes: - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf ports: - - "85:80" + - "90:80" + depends_on: + - service - marketplace-service: + service: image: marketplace-service container_name: marketplace-service restart: always environment: - - MONGODB_HOST=mongodb - - MONGODB_DATABASE=marketplace - - MONGODB_USER=${SERVICE_MONGODB_USER} + - MONGODB_HOST=${SERVICE_MONGODB_HOST} + - MONGODB_DATABASE=${SERVICE_MONGODB_DATABASE} + - MONGODB_USERNAME=${SERVICE_MONGODB_USER} - MONGODB_PASSWORD=${SERVICE_MONGODB_PASSWORD} + - MARKET_GITHUB_TOKEN=${MARKET_GITHUB_TOKEN} build: context: . additional_contexts: assets: ../marketplace-service/target/ dockerfile: Dockerfile-Service + volumes: + - ../marketplace-service/target/marketplace-service-0.0.1-SNAPSHOT.war:/usr/local/tomcat/webapps/marketplace-service.war ports: - "8080:8080" + depends_on: + - mongodb volumes: mongodata: \ No newline at end of file diff --git a/marketplace-build/mongod.conf b/marketplace-build/mongod.conf deleted file mode 100644 index 18b901f07..000000000 --- a/marketplace-build/mongod.conf +++ /dev/null @@ -1,5 +0,0 @@ -security: - authorization: enabled -net: - bindIpAll: true - port: 27017 diff --git a/marketplace-build/release/docker-compose.yml b/marketplace-build/release/docker-compose.yml new file mode 100644 index 000000000..491361199 --- /dev/null +++ b/marketplace-build/release/docker-compose.yml @@ -0,0 +1,14 @@ +name: marketplace-website + +services: + mongodb: + image: ghcr.io/nqhoan-axonivy/marketplace/marketplace-db:latest + + nginx: + image: ghcr.io/nqhoan-axonivy/marketplace/marketplace-nginx:latest + + marketplace-service: + image: ghcr.io/nqhoan-axonivy/marketplace/marketplace-service:latest + +volumes: + mongodata: \ No newline at end of file diff --git a/marketplace-service/src/main/java/com/axonivy/market/github/model/GitHubProperty.java b/marketplace-service/src/main/java/com/axonivy/market/github/model/GitHubProperty.java new file mode 100644 index 000000000..e0e30f669 --- /dev/null +++ b/marketplace-service/src/main/java/com/axonivy/market/github/model/GitHubProperty.java @@ -0,0 +1,20 @@ +package com.axonivy.market.github.model; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Configuration +@ConfigurationProperties(prefix = "market.github") +public class GitHubProperty { + + private String token; +} diff --git a/marketplace-service/src/main/java/com/axonivy/market/github/service/impl/GitHubServiceImpl.java b/marketplace-service/src/main/java/com/axonivy/market/github/service/impl/GitHubServiceImpl.java index 62bbd9181..174e5f44c 100644 --- a/marketplace-service/src/main/java/com/axonivy/market/github/service/impl/GitHubServiceImpl.java +++ b/marketplace-service/src/main/java/com/axonivy/market/github/service/impl/GitHubServiceImpl.java @@ -1,8 +1,6 @@ package com.axonivy.market.github.service.impl; -import java.io.File; import java.io.IOException; -import java.nio.file.Files; import java.util.List; import org.kohsuke.github.GHContent; @@ -12,20 +10,22 @@ import org.kohsuke.github.GitHubBuilder; import org.springframework.stereotype.Service; import org.springframework.util.Assert; -import org.springframework.util.ResourceUtils; +import com.axonivy.market.github.model.GitHubProperty; import com.axonivy.market.github.service.GitHubService; @Service public class GitHubServiceImpl implements GitHubService { - private static final String GITHUB_TOKEN_FILE = "classpath:github.token"; + private GitHubProperty gitHubProperty; + + public GitHubServiceImpl(GitHubProperty gitHubProperty) { + this.gitHubProperty = gitHubProperty; + } @Override public GitHub getGitHub() throws IOException { - File gitHubToken = ResourceUtils.getFile(GITHUB_TOKEN_FILE); - var token = Files.readString(gitHubToken.toPath()); - return new GitHubBuilder().withOAuthToken(token.trim().strip()).build(); + return new GitHubBuilder().withOAuthToken(gitHubProperty.getToken().trim().strip()).build(); } @Override diff --git a/marketplace-service/src/main/resources/application.properties b/marketplace-service/src/main/resources/application.properties index 2fc80c180..6b29fd70d 100644 --- a/marketplace-service/src/main/resources/application.properties +++ b/marketplace-service/src/main/resources/application.properties @@ -1,6 +1,6 @@ spring.application.name=marketplace-service -spring.data.mongodb.host=mongodb://${MONGODB_USER}:${MONGODB_PASSWORD}@${MONGODB_HOST}:27017/ -spring.data.mongodb.database=marketplace +spring.data.mongodb.host=mongodb://${MONGODB_USERNAME}:${MONGODB_PASSWORD}@${MONGODB_HOST}:27017/ +spring.data.mongodb.database=${MONGODB_DATABASE} server.port=8080 logging.level.org.springframework.web=warn request.header=ivy @@ -8,4 +8,5 @@ server.forward-headers-strategy=framework springdoc.api-docs.path=/api-docs springdoc.swagger-ui.path=/swagger-ui.html market.cors.allowed.origin.maxAge=3600 +market.github.token=${MARKET_GITHUB_TOKEN} logging.level.org.springframework.security=DEBUG \ No newline at end of file diff --git a/marketplace-service/src/main/resources/github.token b/marketplace-service/src/main/resources/github.token deleted file mode 100644 index 8433821ba..000000000 --- a/marketplace-service/src/main/resources/github.token +++ /dev/null @@ -1 +0,0 @@ -ghp_replace-with-your-token \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties deleted file mode 100644 index 950647ff3..000000000 --- a/sonar-project.properties +++ /dev/null @@ -1,5 +0,0 @@ -sonar.sources=src/main/java -sonar.tests=src/test/java -sonar.java.binaries=target/classes -sonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml -sonar.exclusions=**/test/**,**/tests/**,**/src/test/**,**/src/**/test/** \ No newline at end of file