Skip to content

Commit

Permalink
Add DB options support (#745)
Browse files Browse the repository at this point in the history
* Update base.py

allow postgres SSL

* Update base.py

* Update database.md

documentation

* Update database.md

* Update database.md

* Update database.md

Docs specified that postgres was the default variable, but settings/base.py:100-115 uses SQLite as default.

* Adjust documentation language

---------

Co-authored-by: Christopher Charbonneau Wells <10456740+cdubz@users.noreply.github.com>
  • Loading branch information
mmomjian and cdubz committed Jan 6, 2024
1 parent bdeb149 commit 9b603a9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions babybuddy/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
config["HOST"] = os.getenv("DB_HOST")
if os.getenv("DB_PORT"):
config["PORT"] = os.getenv("DB_PORT")
if os.getenv("DB_OPTIONS"):
config["OPTIONS"] = os.getenv("DB_OPTIONS")

DATABASES = {"default": config}

Expand Down
20 changes: 13 additions & 7 deletions docs/configuration/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,45 @@

## `DB_ENGINE`

*Default:* `django.db.backends.postgresql`
*Default:* `django.db.backends.sqlite3`

The database engine utilized for the deployment.

See also [Django's documentation on the ENGINE setting](https://docs.djangoproject.com/en/4.0/ref/settings/#engine).

## `DB_HOST`

*Default:* `db`
*Default:* unset

The name of the database host for the deployment.

## `DB_NAME`

*Default:* `postgres`
*Default:* `BASE_DIR/data/db.sqlite3`

The name of the database table utilized for the deployment.

## `DB_PASSWORD`

*Default:* `None`
*Default:* unset

The password for the database user for the deployment. In the default example,
this is the root PostgreSQL password.

## `DB_PORT`

*Default:* `5432`
*Default:* unset

The listening port for the database. The default port is 5432 for PostgreSQL.
The listening port for the database. The default port for PostgreSQL is 5432.

## `DB_USER`

*Default:* `postgres`
*Default:* unset

The database username utilized for the deployment.

## `DB_OPTIONS`

*Default:* unset

Additional options to pass to the database library. See the [Django Databases documentation](https://docs.djangoproject.com/en/5.0/ref/databases/) for examples. To enforce an SSL connection to the database, use `{'sslmode': 'require'}`.

0 comments on commit 9b603a9

Please sign in to comment.