Skip to content

Commit 4b4a3ae

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

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

manifests/server/database.pp

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,29 @@
88
# @param encoding Overrides the character set during creation of the database.
99
# @param locale Overrides the locale during creation of the database.
1010
# @param istemplate Defines the database as a template if set to true.
11+
# @param instance The name of the Postgresql database instance. Default value: 'main'.
1112
# @param connect_settings Specifies a hash of environment variables used when connecting to a remote server.
13+
# @param psql_path Specifies the path to the psql command.
14+
# @param default_db Specifies the name of the default database to connect with. On most systems this is 'postgres'.
15+
# @param user Overrides the default PostgreSQL super user and owner of PostgreSQL related files in the file system.
16+
# @param group Overrides the default postgres user group to be used for related files in the file system.
17+
# @param port Specifies the port for the PostgreSQL server to listen on.
1218
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,
19+
Optional[String[1]] $comment = undef,
20+
String[1] $dbname = $title,
21+
Optional[String[1]] $owner = undef,
22+
Optional[String[1]] $tablespace = undef,
23+
String[1] $template = 'template0',
24+
Optional[String[1]] $encoding = $postgresql::server::encoding,
25+
Optional[String[1]] $locale = $postgresql::server::locale,
26+
Boolean $istemplate = false,
27+
Hash $connect_settings = $postgresql::server::default_connect_settings,
28+
String[1] $user = $postgresql::server::user,
29+
String[1] $group = $postgresql::server::group,
30+
Stdlib::Absolutepath $psql_path = $postgresql::server::psql_path,
31+
String[1] $default_db = $postgresql::server::default_database,
32+
Stdlib::Port $port = $postgresql::server::port
2233
) {
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-
2834
# If possible use the version of the remote database, otherwise
2935
# fallback to our local DB version
3036
if 'DBVERSION' in $connect_settings {
@@ -35,9 +41,9 @@
3541

3642
# If the connection settings do not contain a port, then use the local server port
3743
if 'PGPORT' in $connect_settings {
38-
$port = undef
44+
$port_override = undef
3945
} else {
40-
$port = $postgresql::server::port
46+
$port_override = $port
4147
}
4248

4349
# Set the defaults for the postgresql_psql resource
@@ -46,7 +52,7 @@
4652
psql_user => $user,
4753
psql_group => $group,
4854
psql_path => $psql_path,
49-
port => $port,
55+
port => $port_override,
5056
connect_settings => $connect_settings,
5157
}
5258

0 commit comments

Comments
 (0)