Skip to content

Commit dcc697c

Browse files
database define variables to parameters
1 parent 934c5bb commit dcc697c

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

manifests/server/database.pp

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,27 @@
99
# @param locale Overrides the locale during creation of the database.
1010
# @param istemplate Defines the database as a template if set to true.
1111
# @param connect_settings Specifies a hash of environment variables used when connecting to a remote server.
12+
# @param psql_path Specifies the path to the psql command.
13+
# @param default_db Specifies the name of the default database to connect with. On most systems this is 'postgres'.
14+
# @param user Overrides the default PostgreSQL super user and owner of PostgreSQL related files in the file system.
15+
# @param group Overrides the default postgres user group to be used for related files in the file system.
16+
# @param port Specifies the port for the PostgreSQL server to listen on.
1217
define postgresql::server::database (
13-
Optional[String[1]] $comment = undef,
14-
String[1] $dbname = $title,
15-
Optional[String[1]] $owner = undef,
16-
Optional[String[1]] $tablespace = undef,
17-
String[1] $template = 'template0',
18-
Optional[String[1]] $encoding = $postgresql::server::encoding,
19-
Optional[String[1]] $locale = $postgresql::server::locale,
20-
Boolean $istemplate = false,
21-
Hash $connect_settings = $postgresql::server::default_connect_settings,
18+
Optional[String[1]] $comment = undef,
19+
String[1] $dbname = $title,
20+
Optional[String[1]] $owner = undef,
21+
Optional[String[1]] $tablespace = undef,
22+
String[1] $template = 'template0',
23+
Optional[String[1]] $encoding = $postgresql::server::encoding,
24+
Optional[String[1]] $locale = $postgresql::server::locale,
25+
Boolean $istemplate = false,
26+
Hash $connect_settings = $postgresql::server::default_connect_settings,
27+
String[1] $user = $postgresql::server::user,
28+
String[1] $group = $postgresql::server::group,
29+
Stdlib::Absolutepath $psql_path = $postgresql::server::psql_path,
30+
String[1] $default_db = $postgresql::server::default_database,
31+
Stdlib::Port $port = $postgresql::server::port
2232
) {
23-
$user = $postgresql::server::user
24-
$group = $postgresql::server::group
25-
$psql_path = $postgresql::server::psql_path
26-
$default_db = $postgresql::server::default_database
27-
2833
# If possible use the version of the remote database, otherwise
2934
# fallback to our local DB version
3035
if 'DBVERSION' in $connect_settings {
@@ -35,9 +40,9 @@
3540

3641
# If the connection settings do not contain a port, then use the local server port
3742
if 'PGPORT' in $connect_settings {
38-
$port = undef
43+
$port_override = undef
3944
} else {
40-
$port = $postgresql::server::port
45+
$port_override = $port
4146
}
4247

4348
# Set the defaults for the postgresql_psql resource
@@ -46,7 +51,7 @@
4651
psql_user => $user,
4752
psql_group => $group,
4853
psql_path => $psql_path,
49-
port => $port,
54+
port => $port_override,
5055
connect_settings => $connect_settings,
5156
}
5257

0 commit comments

Comments
 (0)