summaryrefslogtreecommitdiff
path: root/manifests/swagger_ui.pp
blob: 9c6140f59d63df5b7bad1bdc3c7a35925b61ab92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# @summary
#   Configures the Swagger UI
#
# https://swagger.io/tools/swagger-ui/
#
# @param local
#   Local component of where we want to be published.
# @param zone
#   Zone where we want to be published.
# @param www_root
#   Location in filesystem where entry can be found.
class profiles::swagger_ui (
  String $zone = $facts['domain'],
  String $local = 'swagger-ui',
  String $www_root = '/usr/share/webapps/swagger-ui',
) {
  $server_name = "${local}.${zone}"
  include ::php_fpm

  ensure_packages([
    # Available in AUR
    'swagger-ui',
  ])

  @@dns::record { "AAAA ${server_name}":
    type  => 'AAAA',
    zone  => "${zone}.",
    key   => $local,
    value => $facts['ipaddress6'],
  }

  nginx::resource::server { $server_name:
    ipv6_enable          => true,
    ipv6_listen_options  => '',
    www_root             => $www_root,
    use_default_location => false,
    access_log           => absent,
    error_log            => absent,
    *                    => letsencrypt::conf::nginx($server_name),
  }

  php_fpm::nginx { 'swagger-ui':
    server => $server_name,
    conf   => {
      www_root => $www_root,
    },
  }
}