Skip to content

Commit

Permalink
Merge pull request #5 from hellofresh/feature/test-ci
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
italolelis authored Sep 19, 2016
2 parents 1182108 + ddee55c commit ce60778
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 29 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

This is a lightweight, API Gateway and Management Platform enables you to control who accesses your API,
when they access it and how they access it. API Gateway will also record detailed analytics on how your
users are interacting with your API and when things go wrong.
users are interacting with your API and when things go wrong.

## What is an API Gateway?

Expand All @@ -18,7 +18,7 @@ services instead of implementing management infrastructure. For example if you h
web service that provides geolocation data for all the cats in NYC, and you want to make it public,
integrating an API gateway is a faster, more secure route that writing your own authorisation middleware.

## Key Features
## Key Features

This API Gateway offers powerful, yet lightweight features that allow fine gained control over your API ecosystem.

Expand Down
10 changes: 2 additions & 8 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,6 @@ jobs:
context: unit-tests
status: pending

- put: prequest
params:
path: prequest
context: api-tests
status: pending

- aggregate:
- task: pullrequest unit test
config:
Expand All @@ -167,7 +161,7 @@ jobs:
username: {{quay_username}}
password: {{quay_password}}
run:
path: ci/tasks/unit-tests.sh
path: ./ci/tasks/unit-tests.sh
dir: prequest
inputs:
- name: prequest
Expand All @@ -184,4 +178,4 @@ jobs:
context: unit-tests
status: success
params:
PROJECT_SRC: prequest
PROJECT_SRC: /go/src/github.com/hellofresh/api-gateway
15 changes: 0 additions & 15 deletions ci/tasks/unit-tests-pr.yml

This file was deleted.

1 change: 1 addition & 0 deletions ci/tasks/unit-tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
cd ${PROJECT_SRC}

pwd
make test
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ var config Specification
//loadConfigEnv loads environment variables
func loadConfigEnv() Specification {
err := envconfig.Process("", &config)
log.Info(config)
if err != nil {
log.Fatal(err.Error())
}
Expand Down Expand Up @@ -72,6 +71,7 @@ func main() {

accessor := initializeDatabase()
defer accessor.Close()

database := Database{accessor}
router.Use(database.Middleware())

Expand Down
7 changes: 4 additions & 3 deletions middleware_rate_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"strconv"
"time"

"net/http"

"github.com/etcinit/speedbump"
"github.com/gin-gonic/gin"
"net/http"
)

type RateLimitMiddleware struct {
Expand Down Expand Up @@ -46,7 +47,7 @@ func (m RateLimitMiddleware) ProcessRequest(req *http.Request, c *gin.Context) (
if !ok {
m.Logger.Debug("Rate limit exceeded.")
return errors.New("Rate limit exceeded. Try again in " + nextTime.String()), http.StatusTooManyRequests
} else {
return nil, http.StatusOK
}

return nil, http.StatusOK
}

0 comments on commit ce60778

Please sign in to comment.