From dd279e8f59923d1f463da1583a407e4464e6b56b Mon Sep 17 00:00:00 2001 From: Julien Godin Date: Fri, 13 Dec 2024 09:18:44 +0100 Subject: [PATCH] feat: use variable for postgresql locals. Signed-off-by: Julien Godin --- manifests/database/postgresql.pp | 5 ++++- manifests/params.pp | 3 +++ spec/unit/classes/database/postgresql_spec.rb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/manifests/database/postgresql.pp b/manifests/database/postgresql.pp index 825b3fe7..02800d61 100644 --- a/manifests/database/postgresql.pp +++ b/manifests/database/postgresql.pp @@ -49,6 +49,8 @@ # # @param postgresql_ssl_ca_cert_path # Path to the Postgresql SSL CA. +# @param postgresql_locale +# The locale to use for the database. Defaults to `C.UTF-8`. # # @param read_database_username # The name of the read database user to connect as. Defaults to `puppetdb-read`. This @@ -85,6 +87,7 @@ $postgresql_ssl_key_path = $puppetdb::params::postgresql_ssl_key_path, $postgresql_ssl_cert_path = $puppetdb::params::postgresql_ssl_cert_path, $postgresql_ssl_ca_cert_path = $puppetdb::params::postgresql_ssl_ca_cert_path, + $postgresql_locale = $puppetdb::params::postgresql_locale, $read_database_username = $puppetdb::params::read_database_username, Variant[String[1], Sensitive[String[1]]] $read_database_password = $puppetdb::params::read_database_password, $read_database_host = $puppetdb::params::read_database_host, @@ -150,7 +153,7 @@ user => $database_username, password => $database_password, encoding => 'UTF8', - locale => 'en_US.UTF-8', + locale => $postgresql_locale, grant => 'all', port => $port, } diff --git a/manifests/params.pp b/manifests/params.pp index 382c342d..d22af1b7 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -196,6 +196,9 @@ $postgresql_ssl_key_path = "${postgresql_ssl_folder}/private_keys/${trusted['certname']}.pem" $postgresql_ssl_ca_cert_path = "${postgresql_ssl_folder}/certs/ca.pem" + # Configuration of the locales + $postgresql_locale = 'C.UTF-8' + # certificates used for Jetty configuration $ssl_set_cert_paths = false $ssl_cert_path = "${ssl_dir}/public.pem" diff --git a/spec/unit/classes/database/postgresql_spec.rb b/spec/unit/classes/database/postgresql_spec.rb index 74fd63b9..52d0f20a 100644 --- a/spec/unit/classes/database/postgresql_spec.rb +++ b/spec/unit/classes/database/postgresql_spec.rb @@ -63,7 +63,7 @@ grant: 'all', port: params[:database_port].to_i, encoding: 'UTF8', - locale: 'en_US.UTF-8', + locale: params[:postgresql_locale], ) }