I am using spring-data-couchbase in my spring boot application to connect to couchbase database and using application.ymal file to configure all the data source. What is connection string for couchbase database and what configuration I have to do to connect to different environments like dev and prod ? Any help is appreciated. Thanks
You can create an application-dev.yml file for your development environment and an application-prod.yml file for your production environment. In each file, you can specify the appropriate Couchbase connection string and other properties like this:
# application-dev.yml
spring:
data:
couchbase:
connectionString: couchbase://localhost/mybucket
username: myuser
password: mypassword
# application-prod.yml
spring:
data:
couchbase:
connectionString: couchbase://prod.example.com/mybucket
username: produser
password: prodpassword
For example, to activate the dev profile, you can run your application like this:
java -jar myapp.jar -Dspring.profiles.active=dev
And to activate the prod profile, you can run it like this:
java -jar myapp.jar -Dspring.profiles.active=prod