Skip to content

Commit

Permalink
mastodon: don't error if unconfigured
Browse files Browse the repository at this point in the history
  • Loading branch information
pushcx committed Feb 7, 2024
1 parent 5fd0193 commit 77134b0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion extras/mastodon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Mastodon
def self.enabled?
true # Rails.env.production?
Mastodon::TOKEN.present?
end

# these need to be overridden in config/initializers/production.rb
Expand Down
4 changes: 3 additions & 1 deletion script/mastodon_post.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/usr/bin/env ruby

# ENV["RAILS_ENV"] ||= "production"
ENV["RAILS_ENV"] ||= "production"

APP_PATH = File.expand_path("../../config/application", __FILE__)
require File.expand_path("../../config/boot", __FILE__)
require APP_PATH
Rails.application.require_environment!

exit unless Mastodon.enabled? && Mastodon::BOT_NAME

Story.to_mastodon.each_with_index do |s, i|
if i > 0
sleep 2
Expand Down
2 changes: 2 additions & 0 deletions script/mastodon_sync_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
require APP_PATH
Rails.application.require_environment!

exit unless Mastodon.enabled? && Mastodon::LIST_ID

# accept all follow requests
follow_requests = Mastodon.get_follow_requests
follow_requests.each do |id|
Expand Down

0 comments on commit 77134b0

Please sign in to comment.