pgenv version 1.3.3 released

pgenv release 1.3.3 is now available. This release introduces two main environment variables to instrument the application about configuration files. The first variable is PGENV_CONFIGURATION_FILE: such variable can be set to force pgenv to use a custom configuration file without having to guess which file to use depending on the specific PostgreSQL version in use. By default, pgenv looks for a configuration file named after the PostgreSQL version, or if not found, a default.conf configuration file. Using the above variable, it is now possible to pass information to pgenv about where a configuration is, and this allows for the same configuration file to be used over and over without any regard to the PostgreSQL version.

% export PGENV_CONFIGURATION_FILE=~/git/dot-files/pgenv/luca.conf

% pgenv rebuild 16.0
Using PGENV_ROOT /home/luca/git/pgenv
[DEBUG] Configuration file forced by environment variable PGENV_CONFIGURATION_FILE = /home/luca/git/dot-files/pgenv/luca.conf
[DEBUG] Configuration file forced by environment variable PGENV_CONFIGURATION_FILE = /home/luca/git/dot-files/pgenv/luca.conf
[DEBUG] Looking for configuration in /home/luca/git/dot-files/pgenv/luca.conf

...



As you can see, pgenv will now use the specified configuration file. The other variable added is PGENV_WRITE_CONFIGURATION_FILE_AUTOMATICALLY, that if set to a false value (e.g., 0, no) will prevent pgenv to write or overwrite a configuration file once a build or rebuild is completed. The normal behavior is to let pgenv to write/overwrite the configuration file if this variable is not set at all or is set to a true value (e.g., 1, yes), and this is the behavior of previos releases. Since today, if you set this variable to a false value, pgenv will not create (nor overwrite) a configuration file at the end of a build phase.

% export PGENV_WRITE_CONFIGURATION_FILE_AUTOMATICALLY=no
% pgenv rebuild 16.0
...
[DEBUG] Not writing config file automatically: set `PGENV_WRITE_CONFIGURATION_FILE_AUTOMATICALLY` to a true value to enable the automatic file writing
PostgreSQL 16.0 built



As you see from the above, pgenv will complain it cannot write the configuration file for this build. Thanks to this option, you will be sure your carefully crafted configuration file will never be overwritten accidentally (please note that pgenv always make a backup copy before overwriting an existing file). Last, the new subcommand config path has been added: the idea is to show to the user where pgenv expects to find a configuration file and what is going to use without any custom changes.

% pgenv config path
Using PGENV_ROOT /home/luca/git/pgenv
/home/luca/git/pgenv/config/default.conf




The article pgenv version 1.3.3 released has been posted by Luca Ferrari on September 28, 2023