mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 17:35:40 +01:00
Improve error handling in mastodon:setup task (#21464)
This commit is contained in:
parent
99f2534cee
commit
44edf3aa91
1 changed files with 24 additions and 4 deletions
|
@ -17,6 +17,8 @@ namespace :mastodon do
|
|||
ENV.delete('SIDEKIQ_REDIS_URL')
|
||||
|
||||
begin
|
||||
errors = false
|
||||
|
||||
prompt.say('Your instance is identified by its domain name. Changing it afterward will break things.')
|
||||
env['LOCAL_DOMAIN'] = prompt.ask('Domain name:') do |q|
|
||||
q.required true
|
||||
|
@ -95,7 +97,11 @@ namespace :mastodon do
|
|||
rescue => e
|
||||
prompt.error 'Database connection could not be established with this configuration, try again.'
|
||||
prompt.error e.message
|
||||
break unless prompt.yes?('Try again?')
|
||||
unless prompt.yes?('Try again?')
|
||||
return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
|
||||
errors = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -135,7 +141,11 @@ namespace :mastodon do
|
|||
rescue => e
|
||||
prompt.error 'Redis connection could not be established with this configuration, try again.'
|
||||
prompt.error e.message
|
||||
break unless prompt.yes?('Try again?')
|
||||
unless prompt.yes?('Try again?')
|
||||
return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
|
||||
errors = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -420,7 +430,11 @@ namespace :mastodon do
|
|||
rescue => e
|
||||
prompt.error 'E-mail could not be sent with this configuration, try again.'
|
||||
prompt.error e.message
|
||||
break unless prompt.yes?('Try again?')
|
||||
unless prompt.yes?('Try again?')
|
||||
return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
|
||||
errors = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -466,6 +480,7 @@ namespace :mastodon do
|
|||
prompt.ok 'Done!'
|
||||
else
|
||||
prompt.error 'That failed! Perhaps your configuration is not right'
|
||||
errors = true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -482,12 +497,17 @@ namespace :mastodon do
|
|||
prompt.say 'Done!'
|
||||
else
|
||||
prompt.error 'That failed! Maybe you need swap space?'
|
||||
errors = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
prompt.say "\n"
|
||||
prompt.ok 'All done! You can now power on the Mastodon server 🐘'
|
||||
if errors
|
||||
prompt.warn 'Your Mastodon server is set up, but there were some errors along the way, you may have to fix them.'
|
||||
else
|
||||
prompt.ok 'All done! You can now power on the Mastodon server 🐘'
|
||||
end
|
||||
prompt.say "\n"
|
||||
|
||||
if db_connection_works && prompt.yes?('Do you want to create an admin user straight away?')
|
||||
|
|
Loading…
Reference in a new issue