diff --git a/Modulefile b/Modulefile index 26d166d..16647cc 100644 --- a/Modulefile +++ b/Modulefile @@ -8,6 +8,7 @@ description 'This module configures StoryBoard either as a standalone, localhost project_page 'https://github.com/openstack-ci/puppet-storyboard' ## Add dependencies, if any: +dependency 'puppetlabs/stdlib', '= 3.2.0' dependency 'puppetlabs/mysql', '= 0.6.1' dependency 'puppetlabs/apache', '= 0.0.4' dependency 'puppetlabs/rabbitmq', '= 4.0.0' diff --git a/manifests/application.pp b/manifests/application.pp index 15d0bdd..f0672ac 100644 --- a/manifests/application.pp +++ b/manifests/application.pp @@ -25,6 +25,8 @@ class storyboard::application ( $www_root = '/var/lib/storyboard/www', $server_admin = undef, $hostname = $::fqdn, + $cors_allowed_origins = undef, + $cors_max_age = 3600, # storyboard.conf parameters $access_token_ttl = 3600, @@ -48,6 +50,12 @@ class storyboard::application ( $webclient_filename = 'storyboard-webclient-latest.tar.gz' $webclient_url = "http://tarballs.openstack.org/storyboard-webclient/${webclient_filename}" + if $cors_allowed_origins { + $cors_allowed_origins_string = join($cors_allowed_origins, ',') + } else { + $cors_allowed_origins_string = undef + } + # Dependencies require storyboard::params include apache diff --git a/templates/storyboard.conf.erb b/templates/storyboard.conf.erb index 8a39660..7797404 100644 --- a/templates/storyboard.conf.erb +++ b/templates/storyboard.conf.erb @@ -50,6 +50,18 @@ refresh_token_ttl = <%= @refresh_token_ttl %> # and subscriptions. enable_notifications = <%= @enable_notifications %> +<% if scope.lookupvar("storyboard::application::cors_allowed_origins_string") != :undef %> +[cors] +# W3C CORS configuration. For more information, see http://www.w3.org/TR/cors/ + +# List of permitted CORS domains. +allowed_origins = <%= @cors_allowed_origins_string %> + +# CORS browser options cache max age (in seconds) +max_age=<%= @cors_max_age %> + +<% end %> + [database] # This line MUST be changed to actually run storyboard # Example: