Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This file is used to list changes made in the last 3 major versions of the postg

## Unreleased

- Allow to configure multiple databases and users in one `pg_hba.conf` entry

## 11.5.1 - *2023-06-26*

- Fix typo in documentation of `postgresql_extension` resource
Expand Down
2 changes: 1 addition & 1 deletion libraries/access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class PgHbaFile

attr_reader :entries

SPLIT_REGEX = %r{^(((?<type>local)\s+(?<database>[\w\-_]+)\s+(?<user>[\w\d\-_.$]+))|((?!local)(?<type>\w+)\s+(?<database>[\w\-_]+)\s+(?<user>[\w\d\-_.$]+)\s+(?<address>[\w\-.:\/]+)))\s+(?<auth_method>[\w-]+)(?<auth_options>(?:\s+#{AUTH_OPTION_REGEX})*)(?:\s*)(?<comment>#\s*.*)?$}.freeze
SPLIT_REGEX = %r{^(((?<type>local)\s+(?<database>[\w\-_,]+)\s+(?<user>[\w\d\-_.$,]+))|((?!local)(?<type>\w+)\s+(?<database>[\w\-_,]+)\s+(?<user>[\w\d\-_.$,]+)\s+(?<address>[\w\-.:\/]+)))\s+(?<auth_method>[\w-]+)(?<auth_options>(?:\s+#{AUTH_OPTION_REGEX})*)(?:\s*)(?<comment>#\s*.*)?$}.freeze
private_constant :SPLIT_REGEX

def initialize
Expand Down
8 changes: 8 additions & 0 deletions test/cookbooks/test/recipes/access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,11 @@
ldapbasedn: '"dc=example, dc=net"',
ldapsearchattribute: 'uid'
end

postgresql_access 'access with multiple databases' do
type 'host'
database 'foo,bar'
user 'john,doe'
address '127.0.0.1/32'
auth_method 'md5'
end