﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32292	Allow postgresql database connections to use postgres services	levihb	nobody	"Postgres offers a way to make database connections through the use of services, which are basically equivalent to MySQL's options files.

Server, database, username, etc information is stored by default in `~/.pg_service.confg` and takes a very similar format to MySQL cnf files:

```
[my_alias]
host=10.0.19.10
user=postgres
dbname=postgres
port=5432
```

And password can be stored in `~/.pgpass` under a different format.

I think being able to just add them to the DATABASES config would be useful, similar to how you can add MySQL cnf files. psycopg2 supports it just fine through the service argument/string `connect(service='my_alias') connect('service=my_alias')`.

At the moment it can be added like this:

```
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'postgres',
        'OPTIONS': {'service': 'my_alias'}
    }
}
```

Which works, however it involves repeating the database name. I don't think the database name should be repeated twice because it couples the config and the service file together, and makes it harder to just move it between different environments. I think ideally you would just specify the service, either like this:

```
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'OPTIONS': {'service': 'my_alias'}
    }
}
```

Or maybe a better way would be?:

```
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'SERVICE': 'my_alias
    }
}
```

It seems like something that would be super easy to add. I don't mind creating a pull request for it, but would like  to know why it hasn't been added, and how it would be recommended to add it."	New feature	new	Database layer (models, ORM)	3.1	Normal		database postgresql postgres service pg_service config		Unreviewed	0	0	0	0	0	0
