# @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',], # } }