Skip to content

Commit

Permalink
Merge tykcommon into this repo
Browse files Browse the repository at this point in the history
The only changes are the ones from the old repo and the use of our
logger, instead of logrus directly. This means the same log pointer is
used.

Remove the vendored dependency.

Fixes TykTechnologies#390.
  • Loading branch information
mvdan authored and buger committed Feb 6, 2017
1 parent d1cac02 commit 9ea0c08
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package tykcommon
package apidef

import (
"encoding/base64"

"github.com/lonelycode/osin"
"gopkg.in/mgo.v2/bson"
)
Expand Down Expand Up @@ -32,13 +33,13 @@ const (

OttoDriver MiddlewareDriver = "otto"
PythonDriver MiddlewareDriver = "python"
LuaDriver MiddlewareDriver = "lua"
GrpcDriver MiddlewareDriver = "grpc"
LuaDriver MiddlewareDriver = "lua"
GrpcDriver MiddlewareDriver = "grpc"

BodySource IdExtractorSource = "body"
HeaderSource IdExtractorSource = "header"
BodySource IdExtractorSource = "body"
HeaderSource IdExtractorSource = "header"
QuerystringSource IdExtractorSource = "querystring"
FormSource IdExtractorSource = "form"
FormSource IdExtractorSource = "form"

ValueExtractor IdExtractorType = "value"
XPathExtractor IdExtractorType = "xpath"
Expand Down Expand Up @@ -94,8 +95,8 @@ type HardTimeoutMeta struct {
}

type TrackEndpointMeta struct {
Path string `bson:"path" json:"path"`
Method string `bson:"method" json:"method"`
Path string `bson:"path" json:"path"`
Method string `bson:"method" json:"method"`
}

type RequestSizeMeta struct {
Expand Down Expand Up @@ -149,8 +150,8 @@ type ExtendedPathsSet struct {
Virtual []VirtualMeta `bson:"virtual" json:"virtual,omitempty"`
SizeLimit []RequestSizeMeta `bson:"size_limits" json:"size_limits,omitempty"`
MethodTransforms []MethodTransformMeta `bson:"method_transforms" json:"method_transforms,omitempty"`
TrackEndpoints []TrackEndpointMeta `bson:"track_endpoints" json:"track_endpoints,omitempty"`
DoNotTrackEndpoints []TrackEndpointMeta `bson:"do_not_track_endpoints" json:"do_not_track_endpoints,omitempty"`
TrackEndpoints []TrackEndpointMeta `bson:"track_endpoints" json:"track_endpoints,omitempty"`
DoNotTrackEndpoints []TrackEndpointMeta `bson:"do_not_track_endpoints" json:"do_not_track_endpoints,omitempty"`
}

type VersionInfo struct {
Expand Down Expand Up @@ -197,10 +198,10 @@ type MiddlewareDefinition struct {
}

type MiddlewareIdExtractor struct {
ExtractFrom IdExtractorSource `bson:"extract_from" json:"extract_from"`
ExtractWith IdExtractorType `bson:"extract_with" json:"extract_with"`
ExtractorConfig map[string]interface{} `bson:"extractor_config" json:"extractor_config"`
Extractor interface{} `bson:"-" json:"-"`
ExtractFrom IdExtractorSource `bson:"extract_from" json:"extract_from"`
ExtractWith IdExtractorType `bson:"extract_with" json:"extract_with"`
ExtractorConfig map[string]interface{} `bson:"extractor_config" json:"extractor_config"`
Extractor interface{} `bson:"-" json:"-"`
}

type MiddlewareSection struct {
Expand All @@ -210,7 +211,7 @@ type MiddlewareSection struct {
AuthCheck MiddlewareDefinition `bson:"auth_check" json:"auth_check"`
Response []MiddlewareDefinition `bson:"response" json:"response"`
Driver MiddlewareDriver `bson:"driver" json:"driver"`
IdExtractor MiddlewareIdExtractor `bson:"id_extractor" json:"id_extractor"`
IdExtractor MiddlewareIdExtractor `bson:"id_extractor" json:"id_extractor"`
}

type CacheOptions struct {
Expand Down Expand Up @@ -322,7 +323,7 @@ type APIDefinition struct {
DisableRateLimit bool `bson:"disable_rate_limit" json:"disable_rate_limit"`
DisableQuota bool `bson:"disable_quota" json:"disable_quota"`
CustomMiddleware MiddlewareSection `bson:"custom_middleware" json:"custom_middleware"`
CustomMiddlewareBundle string `bson:"custom_middleware_bundle" json:"custom_middleware_bundle"`
CustomMiddlewareBundle string `bson:"custom_middleware_bundle" json:"custom_middleware_bundle"`
CacheOptions CacheOptions `bson:"cache_options" json:"cache_options"`
SessionLifetime int64 `bson:"session_lifetime" json:"session_lifetime"`
Active bool `bson:"active" json:"active"`
Expand Down Expand Up @@ -354,10 +355,10 @@ type APIDefinition struct {
}

type BundleManifest struct {
FileList []string `bson:"file_list" json:"file_list"`
CustomMiddleware MiddlewareSection `bson:"custom_middleware" json:"custom_middleware"`
Checksum string `bson:"checksum" json:"checksum"`
Signature string `bson:"signature" json:"signature"`
FileList []string `bson:"file_list" json:"file_list"`
CustomMiddleware MiddlewareSection `bson:"custom_middleware" json:"custom_middleware"`
Checksum string `bson:"checksum" json:"checksum"`
Signature string `bson:"signature" json:"signature"`
}

// Clean will URL encode map[string]struct variables for saving
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tykcommon
package apidef

import (
"errors"
Expand Down Expand Up @@ -32,7 +32,7 @@ func (h *HostList) Set(newList []string) {
h.hosts = newList
}

func (h *HostList) All() []string{
func (h *HostList) All() []string {
return h.hosts
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package tykcommon
package apidef

import (
"github.com/franela/goreq"
"time"

logger "github.com/TykTechnologies/tyk/log"

"github.com/franela/goreq"
)

var log = logger.Get()

// NotificationsManager handles sending notifications to OAuth endpoints to notify the provider of key changes.
// TODO: Make this more generic
type NotificationsManager struct {
Expand Down
4 changes: 0 additions & 4 deletions vendor/github.com/TykTechnologies/tykcommon/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions vendor/github.com/TykTechnologies/tykcommon/tykcommon.go

This file was deleted.

6 changes: 0 additions & 6 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@
"revision": "aab5ce1231ab090ca20af7b7b45a86ae34235eef",
"revisionTime": "2016-08-17T21:35:54Z"
},
{
"checksumSHA1": "hOr2Xd3wlrIMZyQxwAcy2saINAA=",
"path": "github.com/TykTechnologies/tykcommon",
"revision": "94bf3370ac7827e0bb16e0fafbe8fa37bdc1c2b4",
"revisionTime": "2016-12-01T17:12:18Z"
},
{
"checksumSHA1": "fCQppNcKbizZxVrO/AquOQKHcbk=",
"path": "github.com/alicebob/miniredis",
Expand Down

0 comments on commit 9ea0c08

Please sign in to comment.