| LEFT | RIGHT |
| 1 # == Class: adblockplus::web::redirector | 1 # == Class: adblockplus::web::redirector |
| 2 # | 2 # |
| 3 # Manage a simple Nginx-based service for HTTP redirects. | 3 # Manage a simple Nginx-based service for HTTP redirects. |
| 4 # | 4 # |
| 5 # See http://hub.eyeo.com/issues/1653 for a use case example, | 5 # See http://hub.eyeo.com/issues/1653 for a use case example, |
| 6 # and http://hub.eyeo.com/issues/1975 for more information. | 6 # and http://hub.eyeo.com/issues/1975 for more information. |
| 7 # | 7 # |
| 8 # === Parameters: | 8 # === Parameters: |
| 9 # | 9 # |
| 10 # [*aliases*] | 10 # [*aliases*] |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 # [*ssl_private_key*] | 23 # [*ssl_private_key*] |
| 24 # The name of the private key file within modules/private/files, if any. | 24 # The name of the private key file within modules/private/files, if any. |
| 25 # Requires a certificate as well. | 25 # Requires a certificate as well. |
| 26 # | 26 # |
| 27 # [*targets*] | 27 # [*targets*] |
| 28 # A hash of zero or more redirect URL items indexed by the associated URL | 28 # A hash of zero or more redirect URL items indexed by the associated URL |
| 29 # slug, respectively. | 29 # slug, respectively. |
| 30 # | 30 # |
| 31 # === Examples: | 31 # === Examples: |
| 32 # | 32 # |
| 33 # adblockplus::web::redirector {'example': | 33 # class {'adblockplus::web::redirector': |
| 34 # name => 'adblockplus.to', | 34 # domain => 'adblockplus.to', |
| 35 # targets => { | 35 # targets => { |
| 36 # 'jobs' => 'https://eyeo.com/en/jobs', | 36 # 'jobs' => 'https://eyeo.com/en/jobs', |
| 37 # 'team' => 'https://eyeo.com/en/team', | 37 # 'team' => 'https://eyeo.com/en/team', |
| 38 # }, | 38 # }, |
| 39 # } | 39 # } |
| 40 # | 40 # |
| 41 class adblockplus::web::redirector ( | 41 class adblockplus::web::redirector ( |
| 42 $aliases = [], | 42 $aliases = [], |
| 43 $default = 'https://adblockplus.org/', | 43 $default = 'https://adblockplus.org/', |
| 44 $domain = $::domain, | 44 $domain = $::domain, |
| 45 $ssl_certificate = undef, | 45 $ssl_certificate = undef, |
| 46 $ssl_private_key = undef, | 46 $ssl_private_key = undef, |
| 47 $targets = {}, | 47 $targets = {}, |
| 48 ) { | 48 ) { |
| 49 | 49 |
| 50 include nginx | 50 include nginx |
| 51 | 51 |
| 52 nginx::hostconfig {$title: | 52 nginx::hostconfig {$title: |
| 53 alt_names => $aliases, | 53 alt_names => $aliases, |
| 54 content => template('adblockplus/web/redirector.conf.erb'), | 54 content => template('adblockplus/web/redirector.conf.erb'), |
| 55 certificate => $ssl_certificate, | 55 certificate => $ssl_certificate, |
| 56 domain => $domain, | 56 domain => $domain, |
| 57 is_default => true, | 57 is_default => true, |
| 58 private_key => $ssl_private_key, | 58 private_key => $ssl_private_key, |
| 59 log => 'access_log_redirects', | 59 log => 'access_log_redirects', |
| 60 } | 60 } |
| 61 } | 61 } |
| LEFT | RIGHT |