The app is a target for two slack bots used in the competition. Every day a riddle was posted, and messages must have been sent as a DM to one of the bot. The second bot is there just for drama.
GCP App Engine during execution exposes some of the environment variables. You can see all of them in the GAE docs.
This app reads specified env variables:
- NODE_ENV
- PORT
- GOOGLE_CLOUD_PROJECT
Additionally accessing GCP resources in development environment requires those env vaiables:
- GOOGLE_APPLICATION_CREDENTIALS
This project uses dotenv as a development dependency. You will need to create a .env
file in the root of the directory with all the used env variables set.
Example .env
file:
GOOGLE_CLOUD_PROJECT=gcp_project_id
NODE_ENV=development
GOOGLE_APPLICATION_CREDENTIALS=/users/username/keys/my_service_account.json
Don't set GOOGLE_APPLICATION_CREDENTIALS in .env
file if you have it set as a global variable. Don't use .env
for deployment. Use Secret Manager for storing any secrets.
On localhost start with npm run start:dev
because it injects the dotenv to node app.
To access GCP's resources on localhost, you need to have:
- Service account created.
- Service account added to the project
- Generated .json key file for that service account
- Adding a set of permissions for that service account
For details on this see: https://cloud.google.com/secret-manager/docs/reference/libraries#setting_up_authentication
- Secret Manager Secret Accessor
- Tech stack on GCP
- App Engine with Node 12
- Logger: Winston
- GCP Stackdriver Logging for Winston: Link
- Slack keys and all secrets are kept on GCP Secret Manager
- Data on Firestore
- chat:write
- commands
- im:history
- im:read
- im:write
- users.profile:read
- users:read.email
npm install
- Download and setup service account key for GCP
- setup .env file