Skip to content

Commit

Permalink
Allow module serving from proxy cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilja Bobkevic committed Jun 20, 2015
1 parent d4506ba commit 36c0d14
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ cache_dir = '/opt/forge/cache' # default: File.join(Dir.tmpdir.to_s, 'puppet-for
# Create backends
backends = [
PuppetForgeServer::Backends::Directory.new('/opt/forge/modules'),
# Add directory backend for serving cached modules in case proxy flips over
PuppetForgeServer::Backends::Directory.new(cache_dir),
PuppetForgeServer::Backends::ProxyV3.new('https://forgeapi.puppetlabs.com', cache_dir)
]
Expand Down
6 changes: 5 additions & 1 deletion lib/puppet_forge_server/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ def backends(options)
case type
when 'Proxy'
@log.info "Detecting API version for #{url}..."
PuppetForgeServer::Backends.const_get("#{type}V#{get_api_version(url)}").new(url.chomp('/'), options[:cache_basedir])
[
PuppetForgeServer::Backends.const_get("#{type}V#{get_api_version(url)}").new(url.chomp('/'), options[:cache_basedir]),
# Add directory backend for serving cached modules in case proxy flips over
PuppetForgeServer::Backends.const_get('Directory').new(options[:cache_basedir])
]
else
PuppetForgeServer::Backends.const_get(type).new(url)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_forge_server/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
# limitations under the License.

module PuppetForgeServer
VERSION = '1.5.3'
VERSION = '1.6.0'
end

0 comments on commit 36c0d14

Please sign in to comment.