golangci-api

module
v0.0.0-...-081ecb4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: AGPL-3.0

README

CircleCI GolangCI

API

This repository contains code of API.

Development

Technologies

Go (golang), heroku, circleci, docker, redis, postgres. Web framework is a go kit wrapped with a code generation.

Preparation

Run:

docker-compose up -d
echo "create database api_prod;" | docker-compose exec -T pg psql -Upostgres

It runs postgres and redis needed for both api and worker.

How to run
make run_api
make run_worker
Configuration

Configurate via .env file. Dev .env may be like this:

WEB_ROOT="https://dev.golangci.com"
API_URL="https://api.dev.golangci.com"
GITHUB_CALLBACK_HOST=https://api.dev.golangci.com
DATABASE_URL="postgresql://postgres:test@localhost:5432/api_prod?sslmode=disable"
REDIS_URL="redis://127.0.0.1:6379"
PORT=3000
APP_NAME="GolangCI Dev"

Tests need .env.test file, overriding options from .env. There can be something like this:

DATABASE_URL="postgresql://postgres:test@localhost:5432/api_test?sslmode=disable"
DATABASE_DEBUG=1
How to run tests
echo "CREATE DATABASE api_test;" | docker-compose exec -T pg psql -U postgres
make test
How to test with web

Run golangci-web, golangci-worker and golangci-api. Go to https://dev.golangci.com locally and it will work.

Subscriptions and Payment Gateway

Requirements

To use Subscriptions you will need to configure the env variables for the gateway of your choice.

  • Note: Currently only SecurionPay is supported and uses SECURIONPAY_SECRET and SECURIONPAY_PLANID.
Payment Gateway Callbacks

Run ngrok http 3000 on your development machine, and use https://{ngrok_id}.ngrok.io/v1/payment/{gateway}/events as URL to receive events from the payment gateway.

  • {gateway} for SecurionPay is securionpay.
  • {ngrok_id}'s are unique and you must update the callback URL when you restart Ngrok service.

Contributing

See CONTRIBUTING.

Directories

Path Synopsis
cmd
buildrunner command
ensuredeps command
genservices command
getrepoinfo command
gocodescore command
goenvbuild command
golangci-api command
golangci-worker command
internal
pkg
api
api/models
Code generated by go-queryset.
Code generated by go-queryset.
api/services/auth
Code generated by genservices.
Code generated by genservices.
api/services/events
Code generated by genservices.
Code generated by genservices.
api/services/organization
Code generated by genservices.
Code generated by genservices.
api/services/pranalysis
Code generated by genservices.
Code generated by genservices.
api/services/repo
Code generated by genservices.
Code generated by genservices.
api/services/repoanalysis
Code generated by genservices.
Code generated by genservices.
api/services/repohook
Code generated by genservices.
Code generated by genservices.
api/services/subscription
Code generated by genservices.
Code generated by genservices.
worker/analyze/linters
Package linters is a generated GoMock package.
Package linters is a generated GoMock package.
worker/analyze/prstate
Package prstate is a generated GoMock package.
Package prstate is a generated GoMock package.
worker/analyze/reporters
Package reporters is a generated GoMock package.
Package reporters is a generated GoMock package.
worker/analyze/repostate
Package repostate is a generated GoMock package.
Package repostate is a generated GoMock package.
worker/lib/executors
Package executors is a generated GoMock package.
Package executors is a generated GoMock package.
worker/lib/fetchers
Package fetchers is a generated GoMock package.
Package fetchers is a generated GoMock package.
worker/lib/github
Package github is a generated GoMock package.
Package github is a generated GoMock package.
worker/lib/httputils
Package httputils is a generated GoMock package.
Package httputils is a generated GoMock package.
scripts
consume_dlq command
decode_cookie command
emulate_webhook command
reanalyze_repo command
test

Jump to

Keyboard shortcuts

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