Merge pull request #1143 from owncloud/rename_reva_to_proxy_where_applicable
rename reva to proxy where applicable
This commit is contained in:
8 files changed
+20
-20
No files matched your search
@@ -8,14 +8,14 @@
|
|||||||
},
|
},
|
||||||
"policy_selector": {
|
"policy_selector": {
|
||||||
"migration": {
|
"migration": {
|
||||||
"acc_found_policy" : "reva",
|
"acc_found_policy" : "ocis",
|
||||||
"acc_not_found_policy": "oc10",
|
"acc_not_found_policy": "oc10",
|
||||||
"unauthenticated_policy": "oc10"
|
"unauthenticated_policy": "oc10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"policies": [
|
"policies": [
|
||||||
{
|
{
|
||||||
"name": "reva",
|
"name": "ocis",
|
||||||
"routes": [
|
"routes": [
|
||||||
{
|
{
|
||||||
"endpoint": "/",
|
"endpoint": "/",
|
||||||
|
|||||||
@@ -8,12 +8,12 @@
|
|||||||
},
|
},
|
||||||
"policy_selector": {
|
"policy_selector": {
|
||||||
"static": {
|
"static": {
|
||||||
"policy": "reva"
|
"policy": "ocis"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"policies": [
|
"policies": [
|
||||||
{
|
{
|
||||||
"name": "reva",
|
"name": "ocis",
|
||||||
"routes": [
|
"routes": [
|
||||||
{
|
{
|
||||||
"endpoint": "/",
|
"endpoint": "/",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ func Execute() error {
|
|||||||
app := &cli.App{
|
app := &cli.App{
|
||||||
Name: "ocis-proxy",
|
Name: "ocis-proxy",
|
||||||
Version: version.String,
|
Version: version.String,
|
||||||
Usage: "proxy for Reva/oCIS",
|
Usage: "proxy for oCIS",
|
||||||
Compiled: version.Compiled(),
|
Compiled: version.Compiled(),
|
||||||
|
|
||||||
Authors: []*cli.Author{
|
Authors: []*cli.Author{
|
||||||
|
|||||||
@@ -84,12 +84,12 @@ type Reva struct {
|
|||||||
Middleware Middleware
|
Middleware Middleware
|
||||||
}
|
}
|
||||||
|
|
||||||
// Middleware configures reva middlewares.
|
// Middleware configures proxy middlewares.
|
||||||
type Middleware struct {
|
type Middleware struct {
|
||||||
Auth Auth
|
Auth Auth
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auth configures reva http auth middleware.
|
// Auth configures proxy http auth middleware.
|
||||||
type Auth struct {
|
type Auth struct {
|
||||||
CredentialsByUserAgent map[string]string
|
CredentialsByUserAgent map[string]string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ func LoadSelector(cfg *config.PolicySelector) (Selector, error) {
|
|||||||
// Configuration:
|
// Configuration:
|
||||||
//
|
//
|
||||||
// "policy_selector": {
|
// "policy_selector": {
|
||||||
// "static": {"policy" : "reva"}
|
// "static": {"policy" : "ocis"}
|
||||||
// },
|
// },
|
||||||
func NewStaticSelector(cfg *config.StaticSelectorConf) Selector {
|
func NewStaticSelector(cfg *config.StaticSelectorConf) Selector {
|
||||||
return func(ctx context.Context, r *http.Request) (s string, err error) {
|
return func(ctx context.Context, r *http.Request) (s string, err error) {
|
||||||
@@ -87,7 +87,7 @@ func NewStaticSelector(cfg *config.StaticSelectorConf) Selector {
|
|||||||
// The policy for each case is configurable:
|
// The policy for each case is configurable:
|
||||||
// "policy_selector": {
|
// "policy_selector": {
|
||||||
// "migration": {
|
// "migration": {
|
||||||
// "acc_found_policy" : "reva",
|
// "acc_found_policy" : "ocis",
|
||||||
// "acc_not_found_policy": "oc10",
|
// "acc_not_found_policy": "oc10",
|
||||||
// "unauthenticated_policy": "oc10"
|
// "unauthenticated_policy": "oc10"
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ import (
|
|||||||
func TestStaticSelector(t *testing.T) {
|
func TestStaticSelector(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
req := httptest.NewRequest("GET", "https://example.org/foo", nil)
|
req := httptest.NewRequest("GET", "https://example.org/foo", nil)
|
||||||
sel := NewStaticSelector(&config.StaticSelectorConf{Policy: "reva"})
|
sel := NewStaticSelector(&config.StaticSelectorConf{Policy: "ocis"})
|
||||||
|
|
||||||
want := "reva"
|
want := "ocis"
|
||||||
got, err := sel(ctx, req)
|
got, err := sel(ctx, req)
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Errorf("Expected policy %v got %v", want, got)
|
t.Errorf("Expected policy %v got %v", want, got)
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ func (p *MultiHostReverseProxy) prefixRouteMatcher(endpoint string, target url.U
|
|||||||
func defaultPolicies() []config.Policy {
|
func defaultPolicies() []config.Policy {
|
||||||
return []config.Policy{
|
return []config.Policy{
|
||||||
{
|
{
|
||||||
Name: "reva",
|
Name: "ocis",
|
||||||
Routes: []config.Route{
|
Routes: []config.Route{
|
||||||
{
|
{
|
||||||
Endpoint: "/",
|
Endpoint: "/",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
func TestProxyIntegration(t *testing.T) {
|
func TestProxyIntegration(t *testing.T) {
|
||||||
var tests = []testCase{
|
var tests = []testCase{
|
||||||
// Simple prefix route
|
// Simple prefix route
|
||||||
test("simple_prefix", withPolicy("reva", withRoutes{{
|
test("simple_prefix", withPolicy("ocis", withRoutes{{
|
||||||
Type: config.PrefixRoute,
|
Type: config.PrefixRoute,
|
||||||
Endpoint: "/api",
|
Endpoint: "/api",
|
||||||
Backend: "http://api.example.com"},
|
Backend: "http://api.example.com"},
|
||||||
@@ -24,7 +24,7 @@ func TestProxyIntegration(t *testing.T) {
|
|||||||
expectProxyTo("http://api.example.com/api"),
|
expectProxyTo("http://api.example.com/api"),
|
||||||
|
|
||||||
// Complex prefix route, different method
|
// Complex prefix route, different method
|
||||||
test("complex_prefix_post", withPolicy("reva", withRoutes{{
|
test("complex_prefix_post", withPolicy("ocis", withRoutes{{
|
||||||
Type: config.PrefixRoute,
|
Type: config.PrefixRoute,
|
||||||
Endpoint: "/api",
|
Endpoint: "/api",
|
||||||
Backend: "http://api.example.com/service1/"},
|
Backend: "http://api.example.com/service1/"},
|
||||||
@@ -32,7 +32,7 @@ func TestProxyIntegration(t *testing.T) {
|
|||||||
expectProxyTo("http://api.example.com/service1/api"),
|
expectProxyTo("http://api.example.com/service1/api"),
|
||||||
|
|
||||||
// Query route
|
// Query route
|
||||||
test("query_route", withPolicy("reva", withRoutes{{
|
test("query_route", withPolicy("ocis", withRoutes{{
|
||||||
Type: config.QueryRoute,
|
Type: config.QueryRoute,
|
||||||
Endpoint: "/api?format=json",
|
Endpoint: "/api?format=json",
|
||||||
Backend: "http://backend/"},
|
Backend: "http://backend/"},
|
||||||
@@ -40,7 +40,7 @@ func TestProxyIntegration(t *testing.T) {
|
|||||||
expectProxyTo("http://backend/api?format=json"),
|
expectProxyTo("http://backend/api?format=json"),
|
||||||
|
|
||||||
// Regex route
|
// Regex route
|
||||||
test("regex_route", withPolicy("reva", withRoutes{{
|
test("regex_route", withPolicy("ocis", withRoutes{{
|
||||||
Type: config.RegexRoute,
|
Type: config.RegexRoute,
|
||||||
Endpoint: `\/user\/(\d+)`,
|
Endpoint: `\/user\/(\d+)`,
|
||||||
Backend: "http://backend/"},
|
Backend: "http://backend/"},
|
||||||
@@ -48,7 +48,7 @@ func TestProxyIntegration(t *testing.T) {
|
|||||||
expectProxyTo("http://backend/user/1234"),
|
expectProxyTo("http://backend/user/1234"),
|
||||||
|
|
||||||
// Multiple prefix routes 1
|
// Multiple prefix routes 1
|
||||||
test("multiple_prefix", withPolicy("reva", withRoutes{
|
test("multiple_prefix", withPolicy("ocis", withRoutes{
|
||||||
{
|
{
|
||||||
Type: config.PrefixRoute,
|
Type: config.PrefixRoute,
|
||||||
Endpoint: "/api",
|
Endpoint: "/api",
|
||||||
@@ -63,7 +63,7 @@ func TestProxyIntegration(t *testing.T) {
|
|||||||
expectProxyTo("http://payment.example.com/payment"),
|
expectProxyTo("http://payment.example.com/payment"),
|
||||||
|
|
||||||
// Multiple prefix routes 2
|
// Multiple prefix routes 2
|
||||||
test("multiple_prefix", withPolicy("reva", withRoutes{
|
test("multiple_prefix", withPolicy("ocis", withRoutes{
|
||||||
{
|
{
|
||||||
Type: config.PrefixRoute,
|
Type: config.PrefixRoute,
|
||||||
Endpoint: "/api",
|
Endpoint: "/api",
|
||||||
@@ -78,7 +78,7 @@ func TestProxyIntegration(t *testing.T) {
|
|||||||
expectProxyTo("http://api.example.com/api"),
|
expectProxyTo("http://api.example.com/api"),
|
||||||
|
|
||||||
// Mixed route types
|
// Mixed route types
|
||||||
test("mixed_types", withPolicy("reva", withRoutes{
|
test("mixed_types", withPolicy("ocis", withRoutes{
|
||||||
{
|
{
|
||||||
Type: config.PrefixRoute,
|
Type: config.PrefixRoute,
|
||||||
Endpoint: "/api",
|
Endpoint: "/api",
|
||||||
@@ -94,7 +94,7 @@ func TestProxyIntegration(t *testing.T) {
|
|||||||
expectProxyTo("http://api.example.com/api"),
|
expectProxyTo("http://api.example.com/api"),
|
||||||
|
|
||||||
// Mixed route types
|
// Mixed route types
|
||||||
test("mixed_types", withPolicy("reva", withRoutes{
|
test("mixed_types", withPolicy("ocis", withRoutes{
|
||||||
{
|
{
|
||||||
Type: config.PrefixRoute,
|
Type: config.PrefixRoute,
|
||||||
Endpoint: "/api",
|
Endpoint: "/api",
|
||||||
|
|||||||
Reference in new issue
Block a user