Could not detect default username. Please provide one explicitly

When I run loraserver, it shows time=“2018-06-05T10:11:56Z” level=error msg=“ping database error, will retry in 2s: pq: Could not detect default username. Please provide one explicitly”
But I don’t know why.

Please see the loraserver.toml configuration file :slight_smile:

I am getting the same error. The relevant lines (or at least the lines I’m pretty sure are relevant) in my loraserver.toml file are:# it is also possible to use the following format:
(line 16) user = “loraserver” dbname = “loraserver” sslmode = “disable”
(line 39) dsn=“postgres://loraserver:loraserver@localhost/loraserver?sslmode=disable”

And in my Dockerfile:
loraserver:
build:
context: .
dockerfile: Dockerfile-devel
command: make serve
volumes:
- ./:/go/src/github.com/brocaar/loraserver
links:
- postgres
- redis
- mosquitto
environment:
- DB_AUTOMIGRATE=true
- NET_ID=010203
- BAND=US_902_928
- REDIS_URL=redis://redis:6379
- GW_MQTT_SERVER=tcp://mosquitto:1883
- GW_SERVER_JWT_SECRET=verysecret
- POSTGRES_DSN=postgres://loraserver:loraserver@localhost/loraserver?sslmode=disable
- TEST_POSTGRES_DSN=postgres://loraserver:loraserver@localhost/loraserver?sslmode=disable
- TEST_REDIS_URL=redis://redis:6379
- TEST_MQTT_SERVER=tcp://mosquitto:1883

postgres:
image: postgres:9.5
environment:
- POSTGRES_PASSWORD=loraserver
- POSTGRES_USER=loraserver
- POSTGRES_DB=loraserver

If there is a different way to set or use the default username, it’s not obvious to me.

Please see for a ready to use Docker-compose file: https://www.loraserver.io/install/docker/ :slight_smile: Setting configuration for LoRa Server components through the environment variables is not supported anymore. Please see the example in the link.