Skip to content

Commit

Permalink
Merge branch 'develop' into feature#186
Browse files Browse the repository at this point in the history
  • Loading branch information
PauSansa committed Jul 17, 2023
2 parents b485b8e + 14e0bf4 commit 024e014
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 1 deletion.
2 changes: 1 addition & 1 deletion itachallenge-challenge/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ spring:
name: itachallenge-challenge
cloud:
consul:
enabled: false #habilitar / deshabilitar el uso de consul
enabled: true #habilitar / deshabilitar el uso de consul
#host: 172.24.2.0 #IP del agente consul (Docker)
host: 127.0.0.1 #IP del agente consul (local)
#port: 8500 #puerto HTTP del agente (Docker)
Expand Down
77 changes: 77 additions & 0 deletions itachallenge-gateway/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.0.6'
id 'jacoco'
id 'org.sonarqube' version '4.0.0.2929'
}

jar {
manifest {
attributes(
'Main-Class': 'com.itachallenge.gateway.App'
)
}
}
jacoco{
toolVersion = '0.8.8'
reportsDirectory = layout.buildDirectory.dir('jacocoXml')
}

group = 'ita.challenges'
version = '1.0-SNAPSHOT'

repositories {
mavenCentral()
}

dependencies {

implementation 'org.springframework.boot:spring-boot-autoconfigure:3.0.6'
implementation 'org.springframework.boot:spring-boot-starter-actuator:3.0.6'
implementation 'org.springframework.cloud:spring-cloud-starter-gateway:4.0.2'
implementation 'org.springframework.cloud:spring-cloud-starter-consul-all:4.0.2'

testImplementation 'org.testcontainers:consul:1.18.3'
testImplementation 'org.testcontainers:junit-jupiter:1.18.3'
testImplementation 'org.springframework.boot:spring-boot-starter-test:3.0.6'
testImplementation 'org.springframework.boot:spring-boot-starter-test:3.0.6'
testImplementation 'org.springframework:spring-test:5.3.13'
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.mockito:mockito-core:5.3.1'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.assertj:assertj-core:3.24.2'
}

test {
jvmArgs "-Xshare:off"
useJUnitPlatform()
finalizedBy jacocoTestReport
}

jacocoTestReport {
dependsOn test
reports {
xml.required = true
csv.required = false
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
}

// JaCoCo configuration: https://docs.gradle.org/current/userguide/jacoco_plugin.html
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.7
}
}
}
}

sonar {
properties {
property "sonar.jacoco.reportPaths", jacoco.reportsDirectory
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.itachallenge.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
public class App {

public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
22 changes: 22 additions & 0 deletions itachallenge-gateway/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
spring:
application:
name: itachallenge-gateway
config:
import: optional:consul:localhost:8500

management:
security:
enabled: false

server:
port: 8080

logging:
level:
root: INFO
"[org.springframework.cloud.gateway]": DEBUG
pattern:
# console: Spring's default
file: "%date %5level %-40.40logger{39} [%thread] %msg%n"
# file:
# name: itachallenge-challenge.log
37 changes: 37 additions & 0 deletions itachallenge-gateway/src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
spring:
application:
name: itachallenge-gateway
cloud:
consul:
enabled: true #habilitar / deshabilitar el uso de consul
#host: 172.24.2.0 #IP del agente consul (Docker)
host: 127.0.0.1 #IP del agente consul (local)
#port: 8500 #puerto HTTP del agente (Docker)
port: 8500 #puerto HTTP del agente (local)
config:
enabled: true
discovery:
instanceId: id:${spring.application.name}:${random.value}
serviceName: ${spring.application.name}
enabled: true
register: true
register-health-check: true
deregister: true
port: 8080 #puerto del servicio
prefer-ip-address: true
healthCheckPath: /actuator/health
healthCheckInterval: 10s
gateway:
discovery:
locator:
enabled: true
routes:
- id: itachallenge
uri: http://localhost:8762
predicates:
- Path=/itachallenge/api/v1/challenge/**
filters:
- RewritePath=*/challenge/(?<path>.*), /$\{path}
server:
port: 8080

1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ rootProject.name = 'ita-challenges-backend'
include 'itachallenge-challenge'
include 'itachallenge-score'
include 'itachallenge-user'
include 'itachallenge-gateway'

0 comments on commit 024e014

Please sign in to comment.