Copied Spaces support from packer .rake (#20573)

main
Arthur Isac 2022-11-13 21:58:40 +02:00 committed by GitHub
parent cf36ee99bb
commit 1af482659d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 1 deletions

View File

@ -142,7 +142,40 @@ namespace :mastodon do
prompt.say "\n" prompt.say "\n"
if prompt.yes?('Do you want to store uploaded files on the cloud?', default: false) if prompt.yes?('Do you want to store uploaded files on the cloud?', default: false)
case prompt.select('Provider', ['Amazon S3', 'Wasabi', 'Minio', 'Google Cloud Storage']) case prompt.select('Provider', ['DigitalOcean Spaces', 'Amazon S3', 'Wasabi', 'Minio', 'Google Cloud Storage'])
when 'DigitalOcean Spaces'
env['S3_ENABLED'] = 'true'
env['S3_PROTOCOL'] = 'https'
env['S3_BUCKET'] = prompt.ask('Space name:') do |q|
q.required true
q.default "files.#{env['LOCAL_DOMAIN']}"
q.modify :strip
end
env['S3_REGION'] = prompt.ask('Space region:') do |q|
q.required true
q.default 'nyc3'
q.modify :strip
end
env['S3_HOSTNAME'] = prompt.ask('Space endpoint:') do |q|
q.required true
q.default 'nyc3.digitaloceanspaces.com'
q.modify :strip
end
env['S3_ENDPOINT'] = "https://#{env['S3_HOSTNAME']}"
env['AWS_ACCESS_KEY_ID'] = prompt.ask('Space access key:') do |q|
q.required true
q.modify :strip
end
env['AWS_SECRET_ACCESS_KEY'] = prompt.ask('Space secret key:') do |q|
q.required true
q.modify :strip
end
when 'Amazon S3' when 'Amazon S3'
env['S3_ENABLED'] = 'true' env['S3_ENABLED'] = 'true'
env['S3_PROTOCOL'] = 'https' env['S3_PROTOCOL'] = 'https'