Skip to content

Commit 9fed320

Browse files
committed
added properties profile in userservice
1 parent d3e0e2d commit 9fed320

7 files changed

Lines changed: 90 additions & 36 deletions

File tree

Backend/auth-service/src/main/java/com/teamweave/authservice/Service/UserService.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.teamweave.authservice.Repo.VerificationTokenRepo;
88
import com.teamweave.authservice.ResponseEntity.LoginResponse;
99
import org.springframework.beans.factory.annotation.Autowired;
10+
import org.springframework.beans.factory.annotation.Value;
1011
import org.springframework.http.HttpEntity;
1112
import org.springframework.http.HttpHeaders;
1213
import org.springframework.http.MediaType;
@@ -24,6 +25,13 @@
2425

2526
@Service
2627
public class UserService {
28+
29+
@Value("${user.service.url}")
30+
private String userServiceUrl;
31+
32+
@Value("${auth.service.url}")
33+
private String authServiceUrl;
34+
2735
@Autowired
2836
AuthenticationManager authenticationManager;
2937

@@ -52,7 +60,7 @@ public Users RegisterUser(Users user) {
5260
userRepo.save(user);
5361
String token = UUID.randomUUID().toString();
5462
createVerificationToken(user, token);
55-
String url = "http://localhost:8081";
63+
String url = authServiceUrl;
5664

5765
String verificationLink = url + "/verification/verify?token=" + token;
5866
emailService.sendEmail(user.getEmail(), "Email Verification", "Click the link to verify your email: " + verificationLink);
@@ -163,8 +171,8 @@ public String verifyUser(Users user) {
163171
System.out.println(userProfileDto);
164172

165173
HttpEntity<UserProfileDto> entity = new HttpEntity<>(userProfileDto, headers);
166-
167-
String response = restTemplate.postForObject("http://localhost:8082/userprofile/create", entity, String.class);
174+
String userProfileUrl = userServiceUrl + "/userprofile/create";
175+
String response = restTemplate.postForObject(userProfileUrl, entity, String.class);
168176
System.out.println("Response from user-service: " + response);
169177

170178
} catch (Exception e) {

Backend/auth-service/src/main/resources/application-dev.properties

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,10 @@ spring.application.name=auth-service
2626
# ===============================
2727
# = Server Port =
2828
# ===============================
29-
server.port=8081
29+
server.port=8081
30+
31+
# ===============================
32+
# = Other Service URL =
33+
# ===============================
34+
user.service.url=http://localhost:8082/
35+
auth.service.url=http://localhost:8081/

Backend/auth-service/src/main/resources/application-prod.properties

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,10 @@ spring.application.name=auth-service
2828
# ===============================
2929
# = Server Port =
3030
# ===============================
31-
server.port=8081
31+
server.port=8081
32+
33+
# ===============================
34+
# = Other Service URL =
35+
# ===============================
36+
user.service.url=http://localhost:8082/
37+
auth.service.url=https://auth-service-zq2s.onrender.com

Backend/user-service/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ build/
3131

3232
### VS Code ###
3333
.vscode/
34+
35+
.env
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# ===============================
2+
# = Spring Datasource Settings =
3+
# ===============================
4+
spring.datasource.url=jdbc:mysql://localhost:3306/remote_work_platform
5+
spring.datasource.username=root
6+
spring.datasource.password=Mohan@123
7+
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
8+
9+
# ===============================
10+
# = JPA & Hibernate Settings =
11+
# ===============================
12+
spring.jpa.hibernate.ddl-auto=update
13+
spring.jpa.show-sql=true
14+
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
15+
16+
# ===============================
17+
# = Application Name =
18+
# ===============================
19+
spring.application.name=user-service
20+
21+
# ===============================
22+
# = Server Port =
23+
# ===============================
24+
server.port=8082
25+
26+
# ===============================
27+
# = Other Service URL =
28+
# ===============================
29+
kafka.bootstrap-servers=localhost:9092
30+
31+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# ===============================
2+
# = Spring Datasource Settings =
3+
# ===============================
4+
spring.datasource.url=${DB_URL}
5+
spring.datasource.username=${DB_USERNAME}
6+
spring.datasource.password=${DB_PASSWORD}
7+
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
8+
9+
# ===============================
10+
# = JPA & Hibernate Settings =
11+
# ===============================
12+
spring.jpa.hibernate.ddl-auto=update
13+
spring.jpa.show-sql=true
14+
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
15+
16+
# ===============================
17+
# = Application Name =
18+
# ===============================
19+
spring.application.name=user-service
20+
21+
# ===============================
22+
# = Server Port =
23+
# ===============================
24+
server.port=8082
25+
26+
# ===============================
27+
# = Other Service URL =
28+
# ===============================
29+
kafka.bootstrap-servers=localhost:9092
30+
31+
Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1 @@
1-
# ===============================
2-
# = Spring Datasource Settings =
3-
# ===============================
4-
spring.datasource.url=jdbc:mysql://localhost:3306/remote_work_platform
5-
spring.datasource.username=root
6-
spring.datasource.password=Mohan@123
7-
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
8-
9-
# ===============================
10-
# = JPA & Hibernate Settings =
11-
# ===============================
12-
spring.jpa.hibernate.ddl-auto=update
13-
spring.jpa.show-sql=true
14-
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
15-
16-
# ===============================
17-
# = Application Name =
18-
# ===============================
19-
spring.application.name=user-service
20-
21-
# ===============================
22-
# = Server Port =
23-
# ===============================
24-
server.port=8082
25-
26-
# ===============================
27-
# = Other Service URL =
28-
# ===============================
29-
kafka.bootstrap-servers=localhost:9092
30-
31-
1+
spring.profiles.active=${ENV:dev}

0 commit comments

Comments
 (0)