refactor multiple instances of S3 key check logic to single variable

This commit is contained in:
Gary Windham 2014-07-05 15:16:13 -07:00
parent 3f6bd0606a
commit a28d38d1ed
1 changed files with 4 additions and 2 deletions

View File

@ -135,8 +135,10 @@ class AdminDashboardData
end
def s3_config_check
return I18n.t('dashboard.s3_config_warning') if SiteSetting.enable_s3_uploads and ((!SiteSetting.s3_use_iam_profile and (SiteSetting.s3_access_key_id.blank? or SiteSetting.s3_secret_access_key.blank?)) or SiteSetting.s3_upload_bucket.blank?)
return I18n.t('dashboard.s3_backup_config_warning') if SiteSetting.enable_s3_backups and ((!SiteSetting.s3_use_iam_profile and (SiteSetting.s3_access_key_id.blank? or SiteSetting.s3_secret_access_key.blank?)) or SiteSetting.s3_backup_bucket.blank?)
bad_keys = (SiteSetting.s3_access_key_id.blank? or SiteSetting.s3_secret_access_key.blank?) and !SiteSetting.s3_use_iam_profile
return I18n.t('dashboard.s3_config_warning') if SiteSetting.enable_s3_uploads and (bad_keys or SiteSetting.s3_upload_bucket.blank?)
return I18n.t('dashboard.s3_backup_config_warning') if SiteSetting.enable_s3_backups and (bad_keys or SiteSetting.s3_backup_bucket.blank?)
nil
end