settings.env / database variables not working
- Dominant language
- C#
- Stars
- 20.1k
- Forks
- 1.8k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 75
Description
### Steps To Reproduce
1. Create a docker-compose.yml file like so
```
services:
bitwarden:
depends_on:
- db
env_file:
- settings.env
image: ghcr.io/bitwarden/self-host:beta
restart: always
```
2. create a settings.env file with
- showing ONLY databse relevant variables - there a host of variables
- but htis issue is about these database variables not being read
- interestingly other variables like BW_INSTALLATION_ID & BW_INSTALLATION_KEY seems
- to be read (I am saying seems to be because error logs do not mention this
```
# Database
# Available providers are sqlserver, postgresql, mysql/mariadb, or sqlite
BW_DB_PROVIDER=mysql
BW_DB_SERVER=db
BW_DB_DATABASE=bitwarden_vault
BW_DB_USERNAME=bitwarden
BW_DB_PASSWORD={replace with password}
```
3. Run the usual docker compose commands and get the following error message
WARN[0000] The "BW_DB_DATABASE" variable is not set. Defaulting to a blank string.
WARN[0000] The "BW_DB_USERNAME" variable is not set. Defaulting to a blank string.
WARN[0000] The "BW_DB_PASSWORD" variable is not set. Defaulting to a blank string.
4, however if you hard code the variables in docker-compose.yml under environment: it works!
### Expected Result
I expected the environment variables to be read from settings.env in the same project folder as docker-compose.yml
### Actual Result
It is very clear that the environment variables for the database are not read from settings.env. Interesting other variables seems to be read from the settings.env (I cannot prove it but errors mentions ONLY database variables not set and hence I am assuming the variables for database alone are not being read)
### Screenshots or Videos
none
### Additional Context
host machine is ubuntu server 24.04 LTS
### Githash Version
{"version":"2025.8.0","gitHash":"776f9598-dirty","server":null,"environment":{"cloudRegion":null,"vault":"https://bitwarden.{mydomain.com}","api":"https://bitwarden.{mydomain.com}/api","identity":"https://bitwarden.{mydomain.com}/identity","notifications":"https://bitwarden.{mydomain.com}/notifications","sso":"https://bitwarden.{mydomain.com}/sso"},"featureStates":{},"push":{"pushTechnology":0,"vapidPublicKey":null},"settings":{"disableUserRegistration":false},"object":"config"}
### Environment Details
UBUNTU 24.04 LTS server
```
### Database Image
db:
image: mariadb:10
restart: always
volumes:
- data:/var/lib/mysql
```
### Issue-Link
https://github.com/bitwarden/server/issues/2480
### Issue Tracking Info
- [ ] I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.
Contributor guide
Assessment
This issue has not been assessed yet.