Socket
Book a DemoInstallSign in
Socket

github.com/simplycubed/contactkarma/contacts

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/simplycubed/contactkarma/contacts

v0.0.0-20230219105033-7f4b62058175
Source
Go
Version published
Created
Source

contacts

Contact Karma's Contact API

Authenticating

  • Getting started with API Gateway and Cloud Run
  • Using Firebase to authenticate users
  • Auth locally withGOOGLE_APPLICATION_CREDENTIALS env var

Emulators & Local Dev

  • The Local Firebase Emulator UI in 15 minutes

  • Firebase Emulators are executed with docker-compose.

  • Firestore emulator is using port 9090 instead of 8080 as 8080 is being used by the contacts service.

cd ./emulators
docker-compose build
docker-compose up -d

Environment Variables

The following environment variables are required. For local development a .env file can be created from .env.sample.

Env VarExampleNotes
ALLOWED_ORIGIN"*"Needs to be restricted
ENV"local"local, dev, prod
FIREBASE_URL"contactkarma-dev.firebaseapp.com"
FRONTEND_URL"https://contactkarma.dev"
GOOGLE_CLOUD_PROJECT"contactkarma-dev"
GOOGLE_APPLICATION_CREDENTIALS"/path/to/key/file/key.json"Required for local dev to auth with Firebase
PORT"8080"Cloud Run default

Used for local dev with emulators

Env VarExampleNotes
FIREBASE_AUTH_EMULATOR_HOST"localhost:9090"
FIREBASE_URL"http://localhost:4000?ns=emulatorui"
FIRESTORE_EMULATOR_HOST"localhost:9090"

Authentication

  • Firebase Auth is validated by API Gateway
  • The origional Firebase Auth JWT is copied from Authorization to X-Apigateway-Api-Userinfo
securityDefinitions:
  Bearer:
    type: apiKey
    in: header
    name: X-Apigateway-Api-Userinfo
    description: JWT Token
security:
  - Bearer: []

Running Tests locally

Run test using the command (replace $PATH_TO_ENV_FILE with absoulte file path to env file):

TEST_ENV_PATH=$PATH_TO_ENV_FILE go test -cover ./...

Optionally set TEST_ENV_PATH in vscode extension settings and use test runner tool

"go.testEnvVars": {
  "TEST_ENV_PATH": "~INSERT_ABSOLUTE_PATH_TO_ENV_FILE~"
}

FAQs

Package last updated on 19 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.