How to hide credentials in application.properties
create env.properties
add it to .gitignore
env.properties
after that inside it fill the credentials
DB_DATABASE=NameofyourappSavedIntoYourDB
DB_USER=yourUsername
DB_PASSWORD=SuperStrongPassword
API_KEY=superkey
import it in application.properties
this will enable to access it but still not committing the credentials
spring.config.import=file:env.properties
spring.datasource.url=jdbc:h2:file:~/${DB_DATABASE}
spring.datasource.username=${DB_USER}
spring.datasource.password=${DB_PASSWORD}
Comments
Post a Comment