2 years ago
Hello, I am trying to connect my springboot app to mongodb, I have the application-prod.yml :
spring:
data:
mongodb:
host: ${MONGOHOST}
port: 47734
username: ${MONGOUSER}
password: ${MONGOPASSWORD}
database: mydb
then in the deployment variables I have added the variables with the actual value after deploy I am getting this error :
2024-04-21T06:19:05.866Z INFO 7 --- [ongohost}:47734] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server ${mongohost}:47734
com.mongodb.MongoSocketException: ${mongohost}
at com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:221) ~[mongodb-driver-core-4.11.1.jar!/:na]
at
2 Replies
2 years ago
Could you check if you're indeed reading the correct service variable you have? Try echo-ing the value.
2 years ago
Thanks for answering, I have fixed the problem. It was that I was not applying the changes on the deployment configuraton before running the next deploy. It was my first app being deployed in this tool. Thanks!
Status changed to Solved Railway • almost 2 years ago