Boa noite pessoal, quando clonei o projeto ele veio quebrado tive que ajustar todos os imports, até ai tudo bem, apos os ajustes, fui baixar o postgres (sou acostumado a usar o mysql) baixei a imagem no docker subi e consegui acessar o container, porem quando fui subir a aplicação para verificar se estava ok acabou dando erro de conexão.
Segue o application.yml:
spring:
datasource:
url: jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5432}/${DB_NAME:clines}
username: ${DB_USER:}
password: ${DB_PASSWORD:root}
jpa:
hibernate:
ddl-auto: validate
cors:
allowed:
origins: ${CORS_HOST:http://localhost:3000}
all-methods: true
all-headers: true
send-credentials: true
Erro do console:
Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:285) ~[postgresql-42.2.11.jar:42.2.11]
Estou rodando o postgres no docker, segue o inspect:
"Config": {
"Hostname": "40eec76ec5ea",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"5432/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"POSTGRES_PASSWORD=root",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/13/bin",
"GOSU_VERSION=1.12",
"LANG=en_US.utf8",
"PG_MAJOR=13",
"PG_VERSION=13.4-1.pgdg100+1",
"PGDATA=/var/lib/postgresql/data"
],
"Cmd": [
"postgres"
],
"Image": "postgres",
"Volumes": {
"/var/lib/postgresql/data": {}
},
"WorkingDir": "",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {},
"StopSignal": "SIGINT"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "0317689381a56ffe14196b69c5bd7c28702c0a881177550e77e0e14e3080f8ce",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"5432/tcp": null
},