Skip to content

Commit 94fdf5c

Browse files
committed
fix: set env and port
1 parent 2bc6758 commit 94fdf5c

File tree

6 files changed

+54
-30
lines changed

6 files changed

+54
-30
lines changed

pom.xml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
34
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
45
<modelVersion>4.0.0</modelVersion>
56
<parent>
67
<groupId>org.springframework.boot</groupId>
78
<artifactId>spring-boot-starter-parent</artifactId>
89
<version>3.2.2</version>
9-
<relativePath/> <!-- lookup parent from repository -->
10+
<relativePath /> <!-- lookup parent from repository -->
1011
</parent>
1112
<groupId>br.com.grupo63</groupId>
1213
<artifactId>serviceorder</artifactId>
@@ -15,6 +16,10 @@
1516
<description>FIAP SOAT1 2023 - Group 63 - Phase 4</description>
1617
<properties>
1718
<java.version>17</java.version>
19+
<sonar.coverage.exclusions>
20+
**/config/*,
21+
**/dto/*DTO.*,
22+
</sonar.coverage.exclusions>
1823
</properties>
1924
<repositories>
2025
<repository>
@@ -114,7 +119,6 @@
114119
</dependencies>
115120

116121
<build>
117-
<finalName>app</finalName>
118122
<plugins>
119123
<plugin>
120124
<groupId>org.springframework.boot</groupId>
@@ -127,6 +131,17 @@
127131
</exclude>
128132
</excludes>
129133
</configuration>
134+
<executions>
135+
<execution>
136+
<goals>
137+
<goal>build-info</goal>
138+
</goals>
139+
</execution>
140+
</executions>
141+
</plugin>
142+
<plugin>
143+
<groupId>io.github.git-commit-id</groupId>
144+
<artifactId>git-commit-id-maven-plugin</artifactId>
130145
</plugin>
131146
</plugins>
132147
<resources>
@@ -163,16 +178,8 @@
163178
<version>0.8.11</version>
164179
<configuration>
165180
<excludes>
166-
<exclude>**/br/com/grupo63/serviceorder/controller/dto/ProductControllerDTO.class</exclude>
167-
<exclude>**/br/com/grupo63/serviceorder/controller/dto/OrderItemControllerDTO.class</exclude>
168-
<exclude>**/br/com/grupo63/serviceorder/controller/dto/OrderControllerDTO.class</exclude>
169-
<exclude>**/br/com/grupo63/serviceorder/api/controller/order/dto/CreateOrderRequestDTO.class</exclude>
170-
<exclude>**/br/com/grupo63/serviceorder/gateway/identification/dto/ClientDTO.class</exclude>
171-
<exclude>**/br/com/grupo63/serviceorder/config/JwtFilterConfig.class</exclude>
172-
<exclude>**/br/com/grupo63/serviceorder/config/JPAConfigurer.class</exclude>
173-
<exclude>**/br/com/grupo63/serviceorder/config/JwtService.class</exclude>
174-
<exclude>**/br/com/grupo63/serviceorder/config/JwtFilter.class</exclude>
175-
<exclude>**/br/com/grupo63/serviceorder/config/ValidationConfig.class</exclude>
181+
<exclude>**/dto/*DTO.*</exclude>
182+
<exclude>**/config/**</exclude>
176183
<exclude>**/br/com/grupo63/serviceorder/ServiceOrderApplication.class</exclude>
177184
</excludes>
178185
</configuration>
@@ -200,4 +207,4 @@
200207
</build>
201208
</profile>
202209
</profiles>
203-
</project>
210+
</project>

src/main/java/br/com/grupo63/serviceorder/ServiceOrderApplication.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
package br.com.grupo63.serviceorder;
22

3+
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
34
import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn;
45
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
6+
import io.swagger.v3.oas.annotations.info.Info;
57
import io.swagger.v3.oas.annotations.security.SecurityScheme;
8+
import io.swagger.v3.oas.annotations.servers.Server;
69
import org.springframework.boot.SpringApplication;
710
import org.springframework.boot.autoconfigure.SpringBootApplication;
811
import org.springframework.cloud.openfeign.EnableFeignClients;
912

13+
@OpenAPIDefinition(
14+
info = @Info(title = "${info.name}", description = "${info.description}", version = "${info.version}"),
15+
servers ={
16+
@Server(url = "${server.servlet.context-path:}", description = "Current URL"),
17+
@Server(url = "localhost:${server.port:8080}${server.servlet.context-path:}", description = "Localhost"),
18+
@Server(url = "${app.docs-api-url:(no value)}${server.servlet.context-path:}", description = "Custom URL from env")
19+
})
1020
@SecurityScheme(
1121
name = "bearerAuth",
1222
type = SecuritySchemeType.HTTP,

src/main/java/br/com/grupo63/serviceorder/gateway/identification/IIdentificationGateway.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import java.util.Optional;
1010

11-
@FeignClient(name = "identification", url = "${urls.baseurl-identification}")
11+
@FeignClient(name = "identification", url = "${app.api-url.identification}")
1212
public interface IIdentificationGateway {
1313

1414
@RequestMapping(method = RequestMethod.GET, value = "/identification/clients/{id}")

src/main/resources/application-dev.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ jwt:
2323
key:
2424
public: "${JWT_PUBLIC_KEY:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqStd8n4SGNM0eZhV/hzU+urHA5/IMZPoP9YQ9ZcLKWiX33nI6bSuZMCrLZcJExf63xS+uxDpGxM8Mnk2zOdl+lPwANXLzP1us5P1PyA3YPycW9J7C5YTQW0GiEL3M93ZX7vMJiVoBYblP3JPlYnoYlBORuc0JPk33KtfEZP+78qXpPHM8imYrJLe8ceiDLLFDU/nh5KC2dWAy3ci1ahoJ1Q9ELhp3IZLvOTX57H/T2VKOYOya5+ST41h+JjzI+qGTVnLcKaW+k25YLlVnkSspvdx98+yQDi7kbOTS6yRZHUPD6wPk/nUozpD0nZKccoH4W+zMwmQVtsAA6JCA9gfGwIDAQAB}"
2525

26-
urls:
27-
baseurl-identification: '${BASE_URL_IDENTIFICATION:localhost:8081}'
28-
2926
server:
3027
servlet:
31-
context-path: "/order"
28+
context-path: "/order"
29+
port: 8002
30+
31+
app:
32+
docs-api-url: "${DOCS_API_URL:(no value)}"
33+
api-url:
34+
identification: "${API_URL_IDENTIFICATION:http://localhost:8001}"

src/main/resources/application-prod.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ spring:
66
username: ${DB_USERNAME:backend}
77
devtools:
88
add-properties: false
9-
urls:
10-
baseurl: '/'

src/main/resources/application.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spring:
1010
show-sql: true
1111
profiles:
1212
# Value comes from Maven profile (pom.xml)
13-
active: '@spring.profiles.active@'
13+
active: "@spring.profiles.active@"
1414
flyway:
1515
locations: classpath:db/migrations/{vendor}/
1616
enabled: true
@@ -31,15 +31,21 @@ management:
3131
endpoint:
3232
health:
3333
show-components: always
34+
shutdown:
35+
enabled: true # For debugging
3436
endpoints:
3537
web:
3638
exposure:
37-
include: health, info
38-
info:
39-
name: '@project.name@'
40-
description: '@project.description@'
41-
version: '@project.version@'
39+
include: health, info, metrics, shutdown
40+
41+
# --- Custom keys ---
4242

43-
docs:
44-
api:
45-
url: "${DOCS_API_URL:https://9ah1j49vm1.execute-api.us-east-2.amazonaws.com}"
43+
app:
44+
docs-api-url: "${DOCS_API_URL:(no value)}"
45+
api-url:
46+
identification: ${API_URL_IDENTIFICATION}
47+
48+
info:
49+
name: "@project.name@"
50+
description: "@project.description@"
51+
version: "@project.version@"

0 commit comments

Comments
 (0)