Skip to content

Latest commit

 

History

History
119 lines (77 loc) · 2.29 KB

DEVELOPMENT.md

File metadata and controls

119 lines (77 loc) · 2.29 KB

Development

Setup

Install firebase globally

npm i -g firebase-tools

Install dependencies

npm install

Run everything locally

firebase serve

Deployment

Note: for this you will need access to the project.

Login to your account

firebase login

Deploy everything

firebase deploy

Additional local setup (optional)

Credentials

To be able to use functions that use the Firebase AdminSDK you need to set credentials.

  1. Download the service account file from firebase
  2. Set the path to that file to an environment variable

Linux / MacOS

export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/service-account-file.json"

Windows (PowerShell)

$env:GOOGLE_APPLICATION_CREDENTIALS="C:\Users\username\Downloads\service-account-file.json"

(for more information, please see the docs)

Integrations

To test specific functionality like the integrations you will also have to set the following environment variables

Discord

export discord.token="my_discord_token"

Github

export github.client-secret="my_github_app_client_secret"`
export github.private-key="my_github_app_private_key"

Internal

Internal token is used for self-authentication and for communication with th docker repo.

export internal.token="my_internal_token"

(value can be any single-line string, as long as it's the same in the docker repo)

Local Commands

In order to run firebase locally simply use

firebase serve

To only run one component, like hosting, functions or firestore you may use the --only flag.

firebase serve --only functions

If everything works, finally deploy the changes

firebase deploy

Updating env/config variables

Typically this is only needed when migrating to new firebase project or environment, or when security token needs to rotate.

firebase functions:config:set discord.token="my_discord_token"
firebase functions:config:set github.client-secret="my_github_app_client_secret"
firebase functions:config:set discord.private-key="my_github_app_private_key"
firebase functions:config:set internal.token="my_internal_token"