Skip to content

Commit

Permalink
Merge pull request #6 from ADPRO-C11/staging
Browse files Browse the repository at this point in the history
Initialize Async
  • Loading branch information
sdikyarts authored May 8, 2024
2 parents 08e1cab + 0bb57b3 commit d54fcde
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Replace placeholders in application.properties
run: |
sed -i "s|JDBC_DATABASE_URL=.*|JDBC_DATABASE_URL=${{ secrets.JDBC_DATABASE_URL }}|g" src/main/resources/application.properties
sed -i "s|JDBC_DATABASE_USERNAME=.*|JDBC_DATABASE_USERNAME=${{ secrets.JDBC_DATABASE_USERNAME }}|g" src/main/resources/application.properties
sed -i "s|JDBC_DATABASE_PASSWORD=.*|JDBC_DATABASE_PASSWORD=${{ secrets.JDBC_DATABASE_PASSWORD }}|g" src/main/resources/application.properties
sed -i "s|PRODUCTION=.*|PRODUCTION=${{ secrets.PRODUCTION }}|g" src/main/resources/application.properties
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
Expand Down Expand Up @@ -75,6 +81,7 @@ jobs:
- name: Test with Gradle
run: |
sed -i "s|\${JDBC_DATABASE_URL}|${{ secrets.JDBC_DATABASE_URL }}|g" src/main/resources/application-prod.properties
./gradlew check --info --stacktrace
./gradlew test
./gradlew jacocoTestReport
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package snackscription.subscriptionadmin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.Executor;

@Configuration
@EnableAsync
public class AsyncConfiguration {
@Bean("asyncTaskExecutor")
public Executor asyncTaskExecutor(){
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
taskExecutor.setCorePoolSize(4);
taskExecutor.setQueueCapacity(150);
taskExecutor.setThreadNamePrefix("AsyncTaskThread-");
taskExecutor.initialize();
return taskExecutor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@RestController
@RequestMapping("/admin")
@CrossOrigin(origins = "*")
public class AdminController {
private final AdminService adminService;

Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/application-prod.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
spring.datasource.url=${JDBC_DATABASE_URL}
spring.datasource.username=${JDBC_DATABASE_USERNAME}
spring.datasource.password=${JDBC_DATABASE_PASSWORD}
spring.datasource.url=jdbc:postgresql://aws-0-ap-southeast-1.pooler.supabase.com:543user=postgres.thnfvhxtvcbfxndlxdze&password=YouMakeStrayKidsStay
spring.datasource.username=postgres.thnfvhxtvcbfxndlxdze
spring.datasource.password=YouMakeStrayKidsStay
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.format_sql=true
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spring.application.name=subscription-admin
spring.profiles.active=${PRODUCTION:dev}
spring.profiles.active=${PRODUCTION:prod}

0 comments on commit d54fcde

Please sign in to comment.