contacts

command module
v0.0.0-...-c4b140d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

README

contacts

Contact Karma's Contact API

Authenticating

Emulators & Local Dev

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 Var Example Notes
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 Var Example Notes
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~"
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
gen
mocks/mock_application
Package mock_application is a generated GoMock package.
Package mock_application is a generated GoMock package.
restapi
Package restapi Contact Karma Service
Package restapi Contact Karma Service
gen-jobs
restapi
Package restapi Contact Karma Service
Package restapi Contact Karma Service
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL