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
49
50
51
52
53
54
55
56
57
58
59
60
|
# @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),
}
# TODO enable the setting of default url.
# This is idemponent, but with the following caveats:
# - it will always run, causing an update
# - it will be overwritten by a system update (probably)
# (but then soon after auto fixed by puppet).
#
# $src = 'url: *"\([^"]\|\"\)*"'
# $default_uri = 'https://adrift.space/code/todo-3.0/openapi.yaml'
# .replace('/', '\/')
# exec { 'swagger-ui set default uri':
# command => [
# 'sed',
# "s/${src}/url: \"${default_uri}\"/",
# "${www_root}/swagger-initializer.js"],
# path => ['/bin', '/usr/bin',],
# }
}
|