|
14 | 14 | #
|
15 | 15 | # This class file is not called directly
|
16 | 16 | class nginx::config(
|
17 |
| - $client_body_buffer_size = $nginx::params::nx_client_body_buffer_size, |
18 |
| - $client_body_temp_path = $nginx::params::nx_client_body_temp_path, |
19 |
| - $client_max_body_size = $nginx::params::nx_client_max_body_size, |
20 |
| - $confd_purge = $nginx::params::nx_confd_purge, |
21 |
| - $conf_dir = $nginx::params::nx_conf_dir, |
22 |
| - $conf_template = $nginx::params::nx_conf_template, |
23 |
| - $daemon_user = $nginx::params::nx_daemon_user, |
24 |
| - $events_use = $nginx::params::nx_events_use, |
25 |
| - $fastcgi_cache_inactive = $nginx::params::nx_fastcgi_cache_inactive, |
26 |
| - $fastcgi_cache_key = $nginx::params::nx_fastcgi_cache_key, |
27 |
| - $fastcgi_cache_keys_zone = $nginx::params::nx_fastcgi_cache_keys_zone, |
28 |
| - $fastcgi_cache_levels = $nginx::params::nx_fastcgi_cache_levels, |
29 |
| - $fastcgi_cache_max_size = $nginx::params::nx_fastcgi_cache_max_size, |
30 |
| - $fastcgi_cache_path = $nginx::params::nx_fastcgi_cache_path, |
31 |
| - $fastcgi_cache_use_stale = $nginx::params::nx_fastcgi_cache_use_stale, |
32 |
| - $gzip = $nginx::params::nx_gzip, |
33 |
| - $http_access_log = $nginx::params::nx_http_access_log, |
34 |
| - $http_cfg_append = $nginx::params::nx_http_cfg_append, |
35 |
| - $http_tcp_nodelay = $nginx::params::nx_http_tcp_nodelay, |
36 |
| - $http_tcp_nopush = $nginx::params::nx_http_tcp_nopush, |
37 |
| - $keepalive_timeout = $nginx::params::nx_keepalive_timeout, |
38 |
| - $logdir = $nginx::params::nx_logdir, |
39 |
| - $mail = $nginx::params::nx_mail, |
40 |
| - $multi_accept = $nginx::params::nx_multi_accept, |
41 |
| - $names_hash_bucket_size = $nginx::params::nx_names_hash_bucket_size, |
42 |
| - $names_hash_max_size = $nginx::params::nx_names_hash_max_size, |
43 |
| - $nginx_error_log = $nginx::params::nx_nginx_error_log, |
44 |
| - $pid = $nginx::params::nx_pid, |
45 |
| - $proxy_buffers = $nginx::params::nx_proxy_buffers, |
46 |
| - $proxy_buffer_size = $nginx::params::nx_proxy_buffer_size, |
47 |
| - $proxy_cache_inactive = $nginx::params::nx_proxy_cache_inactive, |
48 |
| - $proxy_cache_keys_zone = $nginx::params::nx_proxy_cache_keys_zone, |
49 |
| - $proxy_cache_levels = $nginx::params::nx_proxy_cache_levels, |
50 |
| - $proxy_cache_max_size = $nginx::params::nx_proxy_cache_max_size, |
51 |
| - $proxy_cache_path = $nginx::params::nx_proxy_cache_path, |
52 |
| - $proxy_conf_template = $nginx::params::nx_proxy_conf_template, |
53 |
| - $proxy_connect_timeout = $nginx::params::nx_proxy_connect_timeout, |
54 |
| - $proxy_headers_hash_bucket_size = $nginx::params::nx_proxy_headers_hash_bucket_size, |
55 |
| - $proxy_http_version = $nginx::params::nx_proxy_http_version, |
56 |
| - $proxy_read_timeout = $nginx::params::nx_proxy_read_timeout, |
57 |
| - $proxy_redirect = $nginx::params::nx_proxy_redirect, |
58 |
| - $proxy_send_timeout = $nginx::params::nx_proxy_send_timeout, |
59 |
| - $proxy_set_header = $nginx::params::nx_proxy_set_header, |
60 |
| - $proxy_temp_path = $nginx::params::nx_proxy_temp_path, |
61 |
| - $run_dir = $nginx::params::nx_run_dir, |
62 |
| - $sendfile = $nginx::params::nx_sendfile, |
63 |
| - $server_tokens = $nginx::params::nx_server_tokens, |
64 |
| - $spdy = $nginx::params::nx_spdy, |
65 |
| - $super_user = $nginx::params::nx_super_user, |
66 |
| - $temp_dir = $nginx::params::nx_temp_dir, |
67 |
| - $types_hash_bucket_size = $nginx::params::nx_types_hash_bucket_size, |
68 |
| - $types_hash_max_size = $nginx::params::nx_types_hash_max_size, |
69 |
| - $vhost_purge = $nginx::params::nx_vhost_purge, |
70 |
| - $worker_connections = $nginx::params::nx_worker_connections, |
71 |
| - $worker_processes = $nginx::params::nx_worker_processes, |
72 |
| - $worker_rlimit_nofile = $nginx::params::nx_worker_rlimit_nofile, |
73 |
| - $global_owner = $nginx::params::global_owner, |
74 |
| - $global_group = $nginx::params::global_group, |
75 |
| - $global_mode = $nginx::params::global_mode, |
76 |
| - $sites_available_owner = $nginx::params::sites_available_owner, |
77 |
| - $sites_available_group = $nginx::params::sites_available_group, |
78 |
| - $sites_available_mode = $nginx::params::sites_available_mode, |
79 |
| -) inherits nginx::params { |
| 17 | + $client_body_buffer_size = undef, |
| 18 | + $client_body_temp_path = undef, |
| 19 | + $client_max_body_size = undef, |
| 20 | + $confd_purge = undef, |
| 21 | + $conf_dir = undef, |
| 22 | + $conf_template = undef, |
| 23 | + $daemon_user = undef, |
| 24 | + $events_use = undef, |
| 25 | + $fastcgi_cache_inactive = undef, |
| 26 | + $fastcgi_cache_key = undef, |
| 27 | + $fastcgi_cache_keys_zone = undef, |
| 28 | + $fastcgi_cache_levels = undef, |
| 29 | + $fastcgi_cache_max_size = undef, |
| 30 | + $fastcgi_cache_path = undef, |
| 31 | + $fastcgi_cache_use_stale = undef, |
| 32 | + $gzip = undef, |
| 33 | + $http_access_log = undef, |
| 34 | + $http_cfg_append = undef, |
| 35 | + $http_tcp_nodelay = undef, |
| 36 | + $http_tcp_nopush = undef, |
| 37 | + $keepalive_timeout = undef, |
| 38 | + $logdir = undef, |
| 39 | + $mail = undef, |
| 40 | + $multi_accept = undef, |
| 41 | + $names_hash_bucket_size = undef, |
| 42 | + $names_hash_max_size = undef, |
| 43 | + $nginx_error_log = undef, |
| 44 | + $pid = undef, |
| 45 | + $proxy_buffers = undef, |
| 46 | + $proxy_buffer_size = undef, |
| 47 | + $proxy_cache_inactive = undef, |
| 48 | + $proxy_cache_keys_zone = undef, |
| 49 | + $proxy_cache_levels = undef, |
| 50 | + $proxy_cache_max_size = undef, |
| 51 | + $proxy_cache_path = undef, |
| 52 | + $proxy_conf_template = undef, |
| 53 | + $proxy_connect_timeout = undef, |
| 54 | + $proxy_headers_hash_bucket_size = undef, |
| 55 | + $proxy_http_version = undef, |
| 56 | + $proxy_read_timeout = undef, |
| 57 | + $proxy_redirect = undef, |
| 58 | + $proxy_send_timeout = undef, |
| 59 | + $proxy_set_header = undef, |
| 60 | + $proxy_temp_path = undef, |
| 61 | + $run_dir = undef, |
| 62 | + $sendfile = undef, |
| 63 | + $server_tokens = undef, |
| 64 | + $spdy = undef, |
| 65 | + $super_user = undef, |
| 66 | + $temp_dir = undef, |
| 67 | + $types_hash_bucket_size = undef, |
| 68 | + $types_hash_max_size = undef, |
| 69 | + $vhost_purge = undef, |
| 70 | + $worker_connections = undef, |
| 71 | + $worker_processes = undef, |
| 72 | + $worker_rlimit_nofile = undef, |
| 73 | + $global_owner = undef, |
| 74 | + $global_group = undef, |
| 75 | + $global_mode = undef, |
| 76 | + $sites_available_owner = undef, |
| 77 | + $sites_available_group = undef, |
| 78 | + $sites_available_mode = undef, |
| 79 | +) { |
80 | 80 |
|
| 81 | + ### Validations ### |
| 82 | + if (!is_string($worker_processes)) and (!is_integer($worker_processes)) { |
| 83 | + fail('$worker_processes must be an integer or have value "auto".') |
| 84 | + } |
| 85 | + if (!is_integer($worker_connections)) { |
| 86 | + fail('$worker_connections must be an integer.') |
| 87 | + } |
| 88 | + if (!is_integer($worker_rlimit_nofile)) { |
| 89 | + fail('$worker_rlimit_nofile must be an integer.') |
| 90 | + } |
| 91 | + if (!is_string($events_use)) and ($events_use != false) { |
| 92 | + fail('$events_use must be a string or false.') |
| 93 | + } |
| 94 | + validate_string($multi_accept) |
| 95 | + validate_string($package_name) |
| 96 | + validate_string($package_ensure) |
| 97 | + validate_string($package_source) |
| 98 | + validate_array($proxy_set_header) |
| 99 | + validate_string($proxy_http_version) |
| 100 | + validate_bool($confd_purge) |
| 101 | + validate_bool($vhost_purge) |
| 102 | + if ($proxy_cache_path != false) { |
| 103 | + validate_string($proxy_cache_path) |
| 104 | + } |
| 105 | + validate_re($proxy_cache_levels, '^[12](:[12])*$') |
| 106 | + validate_string($proxy_cache_keys_zone) |
| 107 | + validate_string($proxy_cache_max_size) |
| 108 | + validate_string($proxy_cache_inactive) |
| 109 | + |
| 110 | + if ($fastcgi_cache_path != false) { |
| 111 | + validate_string($fastcgi_cache_path) |
| 112 | + } |
| 113 | + validate_re($fastcgi_cache_levels, '^[12](:[12])*$') |
| 114 | + validate_string($fastcgi_cache_keys_zone) |
| 115 | + validate_string($fastcgi_cache_max_size) |
| 116 | + validate_string($fastcgi_cache_inactive) |
| 117 | + if ($fastcgi_cache_key != false) { |
| 118 | + validate_string($fastcgi_cache_key) |
| 119 | + } |
| 120 | + if ($fastcgi_cache_use_stale != false) { |
| 121 | + validate_string($fastcgi_cache_use_stale) |
| 122 | + } |
| 123 | + |
| 124 | + validate_bool($configtest_enable) |
| 125 | + validate_string($service_restart) |
| 126 | + validate_bool($mail) |
| 127 | + validate_string($server_tokens) |
| 128 | + validate_string($client_max_body_size) |
| 129 | + if (!is_integer($names_hash_bucket_size)) { |
| 130 | + fail('$names_hash_bucket_size must be an integer.') |
| 131 | + } |
| 132 | + if (!is_integer($names_hash_max_size)) { |
| 133 | + fail('$names_hash_max_size must be an integer.') |
| 134 | + } |
| 135 | + validate_string($proxy_buffers) |
| 136 | + validate_string($proxy_buffer_size) |
| 137 | + if ($http_cfg_append != false) { |
| 138 | + if !(is_hash($http_cfg_append) or is_array($http_cfg_append)) { |
| 139 | + fail('$http_cfg_append must be either a hash or array') |
| 140 | + } |
| 141 | + } |
| 142 | + |
| 143 | + validate_string($nginx_error_log) |
| 144 | + validate_string($http_access_log) |
| 145 | + validate_hash($nginx_upstreams) |
| 146 | + validate_hash($nginx_vhosts) |
| 147 | + validate_hash($nginx_vhosts_defaults) |
| 148 | + validate_hash($nginx_locations) |
| 149 | + validate_hash($nginx_mailhosts) |
| 150 | + validate_bool($manage_repo) |
| 151 | + validate_string($proxy_headers_hash_bucket_size) |
| 152 | + validate_bool($super_user) |
| 153 | + |
| 154 | + validate_hash($string_mappings) |
| 155 | + validate_hash($geo_mappings) |
| 156 | + ### END VALIDATIONS ### |
| 157 | + |
| 158 | + |
| 159 | + ### CONFIGURATION ### |
81 | 160 | File {
|
82 | 161 | owner => $global_owner,
|
83 | 162 | group => $global_group,
|
|
0 commit comments