Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check pg_service.conf file or improve documentation about it #73

Closed
Raruto opened this issue Sep 19, 2022 · 0 comments · Fixed by #86
Closed

Check pg_service.conf file or improve documentation about it #73

Raruto opened this issue Sep 19, 2022 · 0 comments · Fixed by #86
Assignees
Labels
docs Improvements or additions to documentation

Comments

@Raruto
Copy link
Collaborator

Raruto commented Sep 19, 2022

As per v3.4 it seems we are looking for a default service set but on a local ip: 192.168.1.137 (maybe an oversight? a lazy developer day?).

[water_service]
host=192.168.1.137
port=5432
dbname=gis_data
user=postgres
password=postgres

### PG_SERVICE
To use of PostgreSql Service, put your service setups into `./secrets/pg_service.conf file`,
the conf file will be mounted into docker container at runtime to PGSERVICEFILE path position.

# QGIS Server env variables
# ----------------------------------------------------
PGSERVICEFILE=/pg_service/pg_service.conf
# Put your pg service into ./scripts/pg_service.conf file, the conf file will be mounted into
# docker container at runtime a the PGSERVICEFILE

- ./secrets/pg_service.conf:${PGSERVICEFILE}


Ref: https://www.postgresql.org/docs/9.0/libpq-pgservice.html


The Connection Service File

The connection service file allows libpq connection parameters to be associated with a single service name. That service name can then be specified in a libpq connection string, and the associated settings will be used. This allows connection parameters to be modified without requiring a recompile of the libpq-using application. The service name can also be specified using the PGSERVICE environment variable.

Service names can be defined in either a per-user service file or a system-wide file. If the same service name exists in both the user and the system file, the user file takes precedence. By default, the per-user service file is named ~/.pg_service.conf. On Microsoft Windows, it is named %APPDATA%\postgresql\.pg_service.conf (where %APPDATA% refers to the Application Data subdirectory in the user's profile). A different file name can be specified by setting the environment variable PGSERVICEFILE. The system-wide file is named pg_service.conf. By default it is sought in the etc directory of the PostgreSQL installation (use pg_config --sysconfdir to identify this directory precisely). Another directory, but not a different file name, can be specified by setting the environment variable PGSYSCONFDIR.

Either service file uses an “INI file” format where the section name is the service name and the parameters are connection parameters; see Section 34.1.2 for a list. For example:

# comment
[mydb]
host=somehost
port=5433
user=admin

An example file is provided in the PostgreSQL installation at share/pg_service.conf.sample.

Connection parameters obtained from a service file are combined with parameters obtained from other sources. A service file setting overrides the corresponding environment variable, and in turn can be overridden by a value given directly in the connection string. For example, using the above service file, a connection string service=mydb port=5434 will use host somehost, port 5434, user admin, and other parameters as set by environment variables or built-in defaults.


Related to: #71

@Raruto Raruto changed the title Check file or improve documentation about /pg_service/pg_service.conf Check file or improve documentation about pg_service.conf Sep 19, 2022
@Raruto Raruto changed the title Check file or improve documentation about pg_service.conf Check pg_service.conf file or improve documentation about it Sep 19, 2022
@Raruto Raruto added the docs Improvements or additions to documentation label Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants