Skip to content

Commit

Permalink
Fix incorrect data types
Browse files Browse the repository at this point in the history
Some parameter data types are not great and deserve to be changed.  Use
Variant to allow both the old and new data types, but emit a deprecation
warning if the legacy data type is used.

A future backward-incompatible PR will remove these legacy data-types
and the deprecation warnings.
  • Loading branch information
smortex committed Jul 5, 2023
1 parent d27b04c commit 9dd63ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
8 changes: 4 additions & 4 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -805,11 +805,11 @@ Default value: `20`

##### <a name="-nginx--gzip_http_version"></a>`gzip_http_version`

Data type: `Float`
Data type: `Variant[Enum['1.0','1.1'], Float]`



Default value: `1.1`
Default value: `'1.1'`

##### <a name="-nginx--gzip_proxied"></a>`gzip_proxied`

Expand Down Expand Up @@ -901,11 +901,11 @@ Default value: `'65s'`

##### <a name="-nginx--keepalive_requests"></a>`keepalive_requests`

Data type: `String`
Data type: `Variant[Integer, String]`



Default value: `'100'`
Default value: `100`

##### <a name="-nginx--log_format"></a>`log_format`

Expand Down
11 changes: 9 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
Integer $gzip_comp_level = 1,
String $gzip_disable = 'msie6',
Integer $gzip_min_length = 20,
Float $gzip_http_version = 1.1,
Variant[Enum['1.0','1.1'], Float] $gzip_http_version = '1.1',
Nginx::GzipProxied $gzip_proxied = 'off',
Optional[Variant[String[1],Array[String[1]]]] $gzip_types = undef,
Enum['on', 'off'] $gzip_vary = 'off',
Expand All @@ -123,7 +123,7 @@
Enum['on', 'off'] $http_tcp_nodelay = 'on',
Enum['on', 'off'] $http_tcp_nopush = 'off',
Nginx::Time $keepalive_timeout = '65s',
String $keepalive_requests = '100',
Variant[Integer, String] $keepalive_requests = 100,
Hash[String[1], Nginx::LogFormat] $log_format = {},
Hash[String[1], Nginx::LogFormat] $stream_log_format = {},
Boolean $mail = false,
Expand Down Expand Up @@ -244,6 +244,13 @@

### END Hiera Lookups ###
) inherits nginx::params {
if $gzip_http_version =~ Float {
deprecation('Setting gzip_http_version as a Float is deprecated, please convert to String')
}
if $keepalive_requests =~ String {
deprecation('Setting keepalive_requests as a String is deprecation, please convert to Integer')
}

contain 'nginx::package'
contain 'nginx::config'
contain 'nginx::service'
Expand Down

0 comments on commit 9dd63ad

Please sign in to comment.