Merge branch 'master' into try-gookikt-config

This commit is contained in:
A.Unger
2021-11-11 13:04:38 +01:00
39 changed files with 1139 additions and 793 deletions
+7 -2
View File
@@ -45,6 +45,11 @@ type Tracing struct {
Service string `mapstructure:"service"`
}
// Reva defines all available REVA configuration.
type Reva struct {
Address string `address`
}
// TokenManager is the config for using the reva token manager
type TokenManager struct {
JWTSecret string `mapstructure:"jwt_secret"`
@@ -67,7 +72,7 @@ type Config struct {
TokenManager TokenManager `mapstructure:"token_manager"`
Service Service `mapstructure:"service"`
AccountBackend string `mapstructure:"account_backend"`
RevaAddress string `mapstructure:"reva_address"`
Reva Reva `mapstructure:"reva"`
StorageUsersDriver string `mapstructure:"storage_users_driver"`
MachineAuthAPIKey string `mapstructure:"machine_auth_api_key"`
IdentityManagement IdentityManagement `mapstructure:"identity_management"`
@@ -116,7 +121,7 @@ func DefaultConfig() *Config {
Namespace: "com.owncloud.web",
},
AccountBackend: "accounts",
RevaAddress: "127.0.0.1:9142",
Reva: Reva{Address: "127.0.0.1:9142"},
StorageUsersDriver: "ocis",
MachineAuthAPIKey: "change-me-please",
IdentityManagement: IdentityManagement{
+3 -3
View File
@@ -4,6 +4,7 @@ import (
"net/http"
"time"
"github.com/cs3org/reva/pkg/rgrpc/todo/pool"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/go-chi/chi/v5"
@@ -19,7 +20,6 @@ import (
ocsm "github.com/owncloud/ocis/ocs/pkg/middleware"
"github.com/owncloud/ocis/ocs/pkg/service/v0/data"
"github.com/owncloud/ocis/ocs/pkg/service/v0/response"
"github.com/owncloud/ocis/proxy/pkg/cs3"
"github.com/owncloud/ocis/proxy/pkg/user/backend"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
)
@@ -161,9 +161,9 @@ func (o Ocs) getAccountService() accounts.AccountsService {
}
func (o Ocs) getCS3Backend() backend.UserBackend {
revaClient, err := cs3.GetGatewayServiceClient(o.config.RevaAddress)
revaClient, err := pool.GetGatewayServiceClient(o.config.Reva.Address)
if err != nil {
o.logger.Fatal().Msgf("could not get reva client at address %s", o.config.RevaAddress)
o.logger.Fatal().Msgf("could not get reva client at address %s", o.config.Reva.Address)
}
return backend.NewCS3UserBackend(nil, revaClient, o.config.MachineAuthAPIKey, o.logger)
}
+2 -2
View File
@@ -375,7 +375,7 @@ func (o Ocs) DeleteUser(w http.ResponseWriter, r *http.Request) {
return
}
if o.config.RevaAddress != "" && o.config.StorageUsersDriver != "owncloud" {
if o.config.Reva.Address != "" && o.config.StorageUsersDriver != "owncloud" {
t, err := o.mintTokenForUser(r.Context(), account)
if err != nil {
mustNotFail(render.Render(w, r, response.ErrRender(data.MetaServerError.StatusCode, errors.Wrap(err, "error minting token").Error())))
@@ -384,7 +384,7 @@ func (o Ocs) DeleteUser(w http.ResponseWriter, r *http.Request) {
ctx := metadata.AppendToOutgoingContext(r.Context(), revactx.TokenHeader, t)
gwc, err := pool.GetGatewayServiceClient(o.config.RevaAddress)
gwc, err := pool.GetGatewayServiceClient(o.config.Reva.Address)
if err != nil {
o.logger.Error().Err(err).Msg("error securing a connection to Reva gateway")
}