[READ-ONLY] Mirror of https://github.com/glacials/whatsinstandard. a Magic: The Gathering format reference whatsinstandard.com
README.md

Firebase #

This directory holds the Firebase Function maybeTweet, which checks periodically against the What's in Standard? API for changes to Standard, then tweets and toots those changes from @whatsinstandard.

Development #

To test locally, you need firebase-tools installed.

firebase emulators:start

Hit the function from a different terminal:

curl -i http://127.0.0.1:5001/whats-in-standard/us-central1/maybeTweet -d '{}'

To actually test tweeting, you will need some config variables set. WARNING: Depending on your Firebase auth, you may have access to production secrets without realizing it. However you will be using a development (read: empty) Firestore database, so testing this will actually send a tweet when the function thinks it hasn't tweeted a past change yet.

firebase functions:config:set twitter.access_token=CHANGEME twitter.access_token_secret=CHANGEME twitter.api_key=CHANGEME twitter.api_secret=CHANGEME
firebase functions:config:set mastodon.server.url=CHANGEME mastodon.access_token=CHANGEME
firebase functions:config:get > functions/.runtimeconfig.json

To see the database state, you can use the Firebase emualator UI. It should boot with the emulators, and give you a link to access it.

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 #

firebase deploy