dccohen
(David)
7. Mai 2014 um 21:07
1
Discourse seems to use the fog gem, which supports many cloud services, including google cloud storage. But, is discourse currently just written to work with s3 as te cloud storage, or can it be already used with google cloud storage?
Right now for simplicity we are focusing on S3. So either you store stuff locally, on your server, or you store it on Amazon S3.
dccohen
(David)
7. Mai 2014 um 22:43
3
Apart from this:
def s3_bucket
SiteSetting.s3_upload_bucket.downcase
end
def check_missing_site_settings
raise Discourse::SiteSettingMissing.new("s3_upload_bucket") if SiteSetting.s3_upload_bucket.blank?
raise Discourse::SiteSettingMissing.new("s3_access_key_id") if SiteSetting.s3_access_key_id.blank?
raise Discourse::SiteSettingMissing.new("s3_secret_access_key") if SiteSetting.s3_secret_access_key.blank?
end
def s3_options
options = {
provider: 'AWS',
aws_access_key_id: SiteSetting.s3_access_key_id,
aws_secret_access_key: SiteSetting.s3_secret_access_key,
scheme: SiteSetting.scheme,
# cf. https://github.com/fog/fog/issues/2381
path_style: dns_compatible?(s3_bucket, SiteSetting.use_https?),
}
options[:region] = SiteSetting.s3_region unless SiteSetting.s3_region.empty?
options
is there any other s3-specific parts? (Seems like onebox doe snot render the right code line).
If not, all we need is Fog::Storage.new(gcs_options) instead of Fog::Storage.new(s3_options). The rest is handled by fog.
Nothing prevents you from writing your own custom google_cloud_storage_store. And yes, you should probably use the s3_store as a starting point.