Skip to content

Commit

Permalink
align with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
labkode committed Oct 10, 2023
1 parent f690442 commit e160591
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "registry"
linkTitle: "registry"
weight: 10
description: >
Configuration for the registry service
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "dynamic"
linkTitle: "dynamic"
weight: 10
description: >
Configuration for the dynamic service
---

# _struct: config_

{{% dir name="rules" type="map[string]string" default=nil %}}
A map from mountID to provider address [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/storage/registry/dynamic/dynamic.go#L53)
{{< highlight toml >}}
[storage.registry.dynamic]
rules = nil
{{< /highlight >}}
{{% /dir %}}

{{% dir name="rewrites" type="map[string]string" default=nil %}}
A map from a path to an template alias to use when resolving [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/storage/registry/dynamic/dynamic.go#L54)
{{< highlight toml >}}
[storage.registry.dynamic]
rewrites = nil
{{< /highlight >}}
{{% /dir %}}

26 changes: 21 additions & 5 deletions internal/http/interceptors/trace/trace_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
// Copyright 2018-2023 CERN
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// In applying this license, CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

package trace

import (
Expand All @@ -15,15 +33,15 @@ type testPair struct {

func TestGetTrace(t *testing.T) {
pairs := []*testPair{
&testPair{
{
r: newRequest(context.Background(), map[string]string{"X-Trace-ID": "def"}),
e: "def",
},
&testPair{
{
r: newRequest(context.Background(), map[string]string{"X-Request-ID": "abc"}),
e: "abc",
},
&testPair{
{
r: newRequest(trace.Set(context.Background(), "fgh"), nil),
e: "fgh",
},
Expand All @@ -37,7 +55,6 @@ func TestGetTrace(t *testing.T) {
return
}
}

}

func newRequest(ctx context.Context, headers map[string]string) *http.Request {
Expand All @@ -54,5 +71,4 @@ func TestGenerateTrace(t *testing.T) {
t.Fatal("expected random generated UUID 36 chars trace ID but got:" + got)
return
}

}
4 changes: 2 additions & 2 deletions pkg/storage/registry/dynamic/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ type dynamic struct {
}

type config struct {
Rules map[string]string `mapstructure:"rules" docs:"nil;A map from mountID to provider address"`
Rewrites map[string]string `mapstructure:"rewrites" docs:"nil;A map from a path to an template alias to use when resolving"`
Rules map[string]string `docs:"nil;A map from mountID to provider address" mapstructure:"rules"`
Rewrites map[string]string `docs:"nil;A map from a path to an template alias to use when resolving" mapstructure:"rewrites"`
HomePath string `mapstructure:"home_path"`
DBUsername string `mapstructure:"db_username"`
DBPassword string `mapstructure:"db_password"`
Expand Down
8 changes: 4 additions & 4 deletions pkg/storage/registry/dynamic/dynamic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
registryv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1"
ctxpkg "github.com/cs3org/reva/pkg/ctx"
"github.com/cs3org/reva/pkg/appctx"
"github.com/cs3org/reva/pkg/errtypes"

"github.com/cs3org/reva/pkg/storage"
Expand All @@ -53,17 +53,17 @@ var _ = Describe("Dynamic storage provider", func() {
s *server.Server
m sync.Mutex

ctxAlice = ctxpkg.ContextSetUser(context.Background(), &userpb.User{
ctxAlice = appctx.ContextSetUser(context.Background(), &userpb.User{
Id: &userpb.UserId{
OpaqueId: "alice",
},
})
ctxBob = ctxpkg.ContextSetUser(context.Background(), &userpb.User{
ctxBob = appctx.ContextSetUser(context.Background(), &userpb.User{
Id: &userpb.UserId{
OpaqueId: "bob",
},
})
ctxCharlie = ctxpkg.ContextSetUser(context.Background(), &userpb.User{
ctxCharlie = appctx.ContextSetUser(context.Background(), &userpb.User{
Id: &userpb.UserId{
OpaqueId: "charlie",
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/storage/registry/dynamic/rewriter/userrewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"errors"
"strings"

ctxpkg "github.com/cs3org/reva/pkg/ctx"
"github.com/cs3org/reva/pkg/appctx"
"github.com/cs3org/reva/pkg/storage/utils/templates"
)

Expand All @@ -51,7 +51,7 @@ func (ur UserRewriter) GetAlias(ctx context.Context, route string) string {
return route
}

if u, ok := ctxpkg.ContextGetUser(ctx); ok {
if u, ok := appctx.ContextGetUser(ctx); ok {
return templates.WithUser(u, tpl)
}

Expand Down

0 comments on commit e160591

Please sign in to comment.