Skip to content

Commit

Permalink
Merge branch 'release/0.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlHembrough committed Nov 2, 2020
2 parents 5f19ad5 + 9055f18 commit cb39129
Show file tree
Hide file tree
Showing 19 changed files with 339 additions and 188 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ BINPATH ?= build
BUILD_TIME=$(shell date +%s)
GIT_COMMIT=$(shell git rev-parse HEAD)
VERSION ?= $(shell git tag --points-at HEAD | grep ^v | head -n 1)

LDFLAGS = -ldflags "-X main.BuildTime=$(BUILD_TIME) -X main.GitCommit=$(GIT_COMMIT) -X main.Version=$(VERSION)"

export GRAPH_DRIVER_TYPE?=neo4j
export GRAPH_ADDR?=bolt://localhost:7687

.PHONY: all
all: audit test build

Expand All @@ -20,7 +22,7 @@ build:
.PHONY: debug
debug:
go build -tags 'debug' $(LDFLAGS) -o $(BINPATH)/dp-observation-api
GRAPH_DRIVER_TYPE="neo4j" GRAPH_ADDR="bolt://localhost:7687" HUMAN_LOG=1 DEBUG=1 $(BINPATH)/dp-observation-api
HUMAN_LOG=1 DEBUG=1 $(BINPATH)/dp-observation-api

.PHONY: test
test:
Expand Down
6 changes: 3 additions & 3 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"

"github.com/ONSdigital/dp-authorisation/auth"
dpHTTP "github.com/ONSdigital/dp-net/http"
"github.com/ONSdigital/dp-net/request"
"github.com/ONSdigital/dp-observation-api/config"
"github.com/ONSdigital/log.go/log"
"github.com/gorilla/mux"
Expand Down Expand Up @@ -42,13 +42,13 @@ func Setup(ctx context.Context, r *mux.Router, cfg *config.Config, graphDB IGrap

func (api *API) checkIfAuthorised(r *http.Request, logData log.Data) (authorised bool) {

callerIdentity := dpHTTP.Caller(r.Context())
callerIdentity := request.Caller(r.Context())
if callerIdentity != "" {
logData["caller_identity"] = callerIdentity
authorised = true
}

userIdentity := dpHTTP.User(r.Context())
userIdentity := request.User(r.Context())
if userIdentity != "" {
logData["user_identity"] = userIdentity
authorised = true
Expand Down
4 changes: 2 additions & 2 deletions api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package api_test

import (
"context"
"github.com/ONSdigital/dp-net/request"
"net/http"
"net/http/httptest"
"strings"
"sync"
"testing"

"github.com/ONSdigital/dp-authorisation/auth"
dpHTTP "github.com/ONSdigital/dp-net/http"
"github.com/ONSdigital/dp-observation-api/api"
"github.com/ONSdigital/dp-observation-api/api/mock"
errs "github.com/ONSdigital/dp-observation-api/apierrors"
Expand All @@ -22,7 +22,7 @@ import (
const testServiceAuthToken = "testServiceAuthToken"
const testUserAuthToken = "testUserAuthToken"

var ctx = context.WithValue(context.Background(), dpHTTP.FlorenceIdentityKey, testUserAuthToken)
var ctx = context.WithValue(context.Background(), request.FlorenceIdentityKey, testUserAuthToken)

var (
mu sync.Mutex
Expand Down
1 change: 1 addition & 0 deletions api/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
type IGraph interface {
driver.Driver
StreamCSVRows(ctx context.Context, instanceID, filterID string, filters *observation.DimensionFilters, limit *int) (observation.StreamRowReader, error)
ErrorChan() chan error
}

// IDatasetClient represents the required methods from the Dataset Client required by Observation API
Expand Down
13 changes: 5 additions & 8 deletions api/mock/authorisation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 15 additions & 18 deletions api/mock/dataset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 56 additions & 23 deletions api/mock/graph.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cb39129

Please sign in to comment.