Skip to content

Commit

Permalink
Revert "Wrong route decorator order."
Browse files Browse the repository at this point in the history
This reverts commit 2fca341.
  • Loading branch information
Clément RUFFINONI committed Jul 15, 2019
1 parent 2fca341 commit d3664c0
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 1,010 deletions.
11 changes: 0 additions & 11 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/sqldialects.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/trackit-server.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

887 changes: 0 additions & 887 deletions .idea/workspace.xml

This file was deleted.

15 changes: 11 additions & 4 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ services:
- app
ports:
- '127.0.0.1:3306:3306'
es:
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.3
environment:
- ES_JAVA_OPTS "-Xms1g -Xmx1g"
networks:
- app
ports:
- '127.0.0.1:9200:9200'
redis:
image: redis:latest
command: ["redis-server", "--requirepass changeme"]
command: ["redis-server", "--appendonly", "yes"]
networks:
- app
ports:
Expand All @@ -25,10 +33,9 @@ services:
- redis
command:
- -sql-address=${TRACKIT_SQL_USER:-trackit}:${TRACKIT_SQL_PASSWORD:-trackitpassword}@tcp(sql:3306)/${TRACKIT_SQL_DATABASE:-trackit}?parseTime=true
- -es-address=http://10.20.0.10:9200/
- -redis-address=${TRACKIT_REDIS_ADDRESS:-redis:6379}
- -es-address=${TRACKIT_ES_ADDRESS:-http://es:9200}
- -redis-address=${TRACKIT_REDIS_ADDRESS:-http://redis:6379}
- -http-address=[::]:80
- -periodics=false
environment:
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
Expand Down
15 changes: 0 additions & 15 deletions routes/commonQueryArgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,4 @@ var (
Type: QueryArgInt{},
Description: "The DB ID of the sharing",
}

// Pagination
AskedPage = QueryArg{
Name: "page",
Type: QueryArgInt{},
Description: "The asked page for the pagination.",
Optional: true,
}

ResultPerPage = QueryArg{
Name: "result",
Type: QueryArgInt{},
Description: "The number of result per page",
Optional: true,
}
)
22 changes: 12 additions & 10 deletions routes/decoratorCors.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,19 @@ func (c Cors) Decorate(h Handler) Handler {
}

// getFunc builds a handler function for Cors.Decorate.
func (_ Cors) getFunc(hf HandlerFunc, hd HandlerDocumentation, headersValues ...[]string) HandlerFunc {
func (_ Cors) getFunc(
hf HandlerFunc,
hd HandlerDocumentation,
acaMethods []string,
acaOrigin []string,
acaHeaders []string,
acaCredentials []string,
) HandlerFunc {
return func(w http.ResponseWriter, r *http.Request, a Arguments) (int, interface{}) {
headerKeys := []string {
"Access-Control-Allow-Methods",
"Access-Control-Allow-Origin",
"Access-Control-Allow-Headers",
"Access-Control-Allow-Credentials",
}
for i, key := range headerKeys {
w.Header()[key] = headersValues[i]
}
w.Header()["Access-Control-Allow-Methods"] = acaMethods
w.Header()["Access-Control-Allow-Origin"] = acaOrigin
w.Header()["Access-Control-Allow-Headers"] = acaHeaders
w.Header()["Access-Control-Allow-Credentials"] = acaCredentials
if r.Method == http.MethodOptions {
return http.StatusOK, hd
} else {
Expand Down
2 changes: 1 addition & 1 deletion usageReports/ec2Coverage/ec2_coverage_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ func init() {
db.RequestTransaction{Db: db.Db},
users.RequireAuthenticatedUser{users.ViewerAsParent},
routes.QueryArgs(ec2CoverageQueryArgs),
cache.UsersCache{},
routes.Documentation{
Summary: "get the list of EC2 Coverage reports",
Description: "Responds with the list of EC2 Coverage reports based on the queryparams passed to it",
},
cache.UsersCache{},
),
}.H().Register("/ec2/coverage")
}
Expand Down
54 changes: 0 additions & 54 deletions util/pagination.go

This file was deleted.

0 comments on commit d3664c0

Please sign in to comment.