Skip to content

Latest commit

 

History

History
 
 

firebase

Firebase

This directory holds the Firebase Function detectRotations, which checks periodically against the What's in Standard? API for changes to Standard, then tweets the changes to Twitter from @whatsinstandard and toots them to Mastodon from @[email protected].

Development

To test locally, you need firebase-tools installed.

npm install -g firebase-tools

To actually test tweeting and tooting, you will need to set these secrets in Google Cloud Secret Manager:

MASTODON_ACCESS_TOKEN
TWITTER_BEARER_TOKEN

Now, visit the Firebase console and add the following structure to Firestore manually:

twitterbot      (collection)
  last-known    (document)
    sets        (collection)
      deleteme  (document)
mastodonbot     (collection)
  last-known    (document)
    sets        (collection)
      deleteme  (document)

Open a Firebase shell:

firebase use whats-in-standard-beta # Or your non-production project name
firebase functions:shell # Note that changes to .env require rerunning this

and invoke the function:

detectRotations()

Architecture

The cron architecture is embedded in the Firebase function; there is no separate architecture that pings it. Look for the functions.pubsub.schedule call.

Deploying

mv functions/.env ~/.env.firebase.tmp

# Make sure the following command prints "Now using project whats-in-standard"
firebase use whats-in-standard

firebase deploy
firebase use whats-in-standard-beta
mv ~/.env.firebase.tmp functions/.env

Then revert .firebaserc.