Dashboard warning when s3_backups are globally configured


(Michael Brown) #1

With global settings in the .yml file similar to:

  DISCOURSE_S3_REGION: us-west-1
  DISCOURSE_S3_BUCKET: fetch-me-a-bucket
  DISCOURSE_S3_CDN_URL: https://fhqwhgads.cloudfront.net
  DISCOURSE_S3_USE_IAM_PROFILE: true
  DISCOURSE_S3_BACKUP_BUCKET: baby-got-bucket
  DISCOURSE_ENABLE_S3_BACKUPS: true

We get an admin dashboard warning about the backup configuration:

image

This is appearing because in s3_config_check() enable_s3_backups is shadowed by the global value, whereas the other values aren’t so bad_keys is triggered:

  def s3_config_check
    bad_keys = (SiteSetting.Upload.s3_access_key_id.blank? || SiteSetting.Upload.s3_secret_access_key.blank?) && !SiteSetting.Upload.s3_use_iam_profile

    return I18n.t('dashboard.s3_config_warning') if SiteSetting.enable_s3_uploads && (bad_keys || SiteSetting.s3_upload_bucket.blank?)
    return I18n.t('dashboard.s3_backup_config_warning') if SiteSetting.enable_s3_backups && (bad_keys || SiteSetting.s3_backup_bucket.blank?)
    nil
  end

(Sam Saffron) #7

OK, I went with the simplest possible fix at:


(Sam Saffron) #8