Skip to content

Commit

Permalink
allow regexs to be used when checking availability for envs
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanRada committed Jun 21, 2016
1 parent f7636f5 commit 9f78c45
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/washout_builder/engine.rb
Expand Up @@ -10,7 +10,7 @@ class Engine < ::Rails::Engine
app.config.washout_builder[:blacklisted_envs]
)
mounted_path = app.config.washout_builder[:mounted_path]
if env_checker.enabled_for_env?(Rails.env)
if env_checker.available_for_env?(Rails.env)
app.routes.append do
mount WashoutBuilder::Engine => mounted_path if mounted_path.is_a?(String) && mounted_path.starts_with?('/')
end
Expand Down
2 changes: 1 addition & 1 deletion lib/washout_builder/env_checker.rb
Expand Up @@ -8,7 +8,7 @@ def initialize(whitelist, blacklist)
self.blacklist = get_valid_data(blacklist)
end

def enabled_for_env?(env_name)
def available_for_env?(env_name)
if (whitelist.present? || blacklist.present?) && whitelist.find{|a| blacklist.include?(a) }.blank?
if whitelist.include?('*') || (!valid_for_env?(blacklist, env_name) || valid_for_env?(whitelist, env_name))
return true
Expand Down

0 comments on commit 9f78c45

Please sign in to comment.