Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
case0sh committed Oct 6, 2023
1 parent 3663a0a commit c12c8f3
Show file tree
Hide file tree
Showing 15 changed files with 208 additions and 202 deletions.
4 changes: 2 additions & 2 deletions services/frontend/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type Config struct {

TransferSecret string `yaml:"transfer_secret" env:"OCIS_TRANSFER_SECRET" desc:"Transfer secret for signing file up- and download requests."`

TokenManager *TokenManager `yaml:"token_manager"`
Reva *shared.Reva `yaml:"reva"`
TokenManager *TokenManager `yaml:"token_manager"`
Reva *shared.Reva `yaml:"reva"`

SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"FRONTEND_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."`

Expand Down
3 changes: 1 addition & 2 deletions services/idp/pkg/backends/cs3/bootstrap/cs3.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ package bootstrap

import (
"fmt"
"os"

"github.com/libregraph/lico/bootstrap"
"github.com/libregraph/lico/identifier"
"github.com/libregraph/lico/identity"
"github.com/libregraph/lico/identity/managers"
cs3 "github.com/owncloud/ocis/v2/services/idp/pkg/backends/cs3/identifier"
"os"
)

// Identity managers.
Expand Down
20 changes: 10 additions & 10 deletions services/idp/pkg/backends/cs3/identifier/cs3.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ var cs3SpportedScopes = []string{
type CS3Backend struct {
supportedScopes []string

logger logrus.FieldLogger
tlsConfig *tls.Config
gatewayURI string
insecure bool
logger logrus.FieldLogger
tlsConfig *tls.Config
gatewayURI string
insecure bool

sessions cmap.ConcurrentMap

Expand All @@ -58,10 +58,10 @@ func NewCS3Backend(
b := &CS3Backend{
supportedScopes: supportedScopes,

logger: c.Logger,
tlsConfig: tlsConfig,
gatewayURI: gatewayURI,
insecure: insecure,
logger: c.Logger,
tlsConfig: tlsConfig,
gatewayURI: gatewayURI,
insecure: insecure,

sessions: cmap.New(),
}
Expand Down Expand Up @@ -154,8 +154,8 @@ func (b *CS3Backend) ResolveUserByUsername(ctx context.Context, username string)
client := cs3gateway.NewGatewayAPIClient(l)

res, err := client.Authenticate(ctx, &cs3gateway.AuthenticateRequest{
Type: "machine",
ClientId: "username:" + username,
Type: "machine",
ClientId: "username:" + username,
})
if err != nil {
return nil, fmt.Errorf("cs3 backend machine authenticate rpc error: %v", err)
Expand Down
1 change: 0 additions & 1 deletion services/idp/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type Config struct {

Reva *shared.Reva `yaml:"reva"`


Asset Asset `yaml:"asset"`
IDP Settings `yaml:"idp"`
Clients []Client `yaml:"clients"`
Expand Down
1 change: 0 additions & 1 deletion services/idp/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ func EnsureDefaults(cfg *config.Config) {
cfg.Reva = structs.CopyOrZeroValue(cfg.Commons.Reva)
}


}

// Sanitize sanitizes the configuration
Expand Down
2 changes: 1 addition & 1 deletion services/idp/pkg/service/v0/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func createTemporaryClientsConfig(filePath, ocisURL string, clients []config.Cli
// Init cs3 backend vars which are currently not accessible via idp api
func initCS3EnvVars(cs3Addr string) error {
defaults := map[string]string{
"CS3_GATEWAY": cs3Addr,
"CS3_GATEWAY": cs3Addr,
}

for k, v := range defaults {
Expand Down
1 change: 0 additions & 1 deletion services/ocdav/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type Config struct {
// Timeout in seconds when making requests to the gateway
Timeout int64 `yaml:"gateway_request_timeout" env:"OCDAV_GATEWAY_REQUEST_TIMEOUT" desc:"Request timeout in seconds for requests from the oCDAV service to the GATEWAY service."`


Context context.Context `yaml:"-"`
Status Status `yaml:"-"`

Expand Down
14 changes: 7 additions & 7 deletions services/ocdav/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ func DefaultConfig() *config.Config {
Service: config.Service{
Name: "ocdav",
},
Reva: shared.DefaultRevaConfig(),
WebdavNamespace: "/users/{{.Id.OpaqueId}}",
FilesNamespace: "/users/{{.Id.OpaqueId}}",
SharesNamespace: "/Shares",
PublicURL: "https://localhost:9200",
Insecure: false,
Timeout: 84300,
Reva: shared.DefaultRevaConfig(),
WebdavNamespace: "/users/{{.Id.OpaqueId}}",
FilesNamespace: "/users/{{.Id.OpaqueId}}",
SharesNamespace: "/Shares",
PublicURL: "https://localhost:9200",
Insecure: false,
Timeout: 84300,
Status: config.Status{
Version: version.Legacy,
VersionString: version.LegacyString,
Expand Down
26 changes: 13 additions & 13 deletions services/policies/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import (

// Config combines all available configuration parts.
type Config struct {
Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service
GRPC GRPC `yaml:"grpc"`
Service Service `yaml:"-"`
Debug Debug `yaml:"debug"`
TokenManager *TokenManager `yaml:"token_manager"`
Events Events `yaml:"events"`
Reva *shared.Reva `yaml:"reva"`
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
Context context.Context `yaml:"-"`
Log *Log `yaml:"log"`
Engine Engine `yaml:"engine"`
Postprocessing Postprocessing `yaml:"postprocessing"`
Tracing *Tracing `yaml:"tracing"`
Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service
GRPC GRPC `yaml:"grpc"`
Service Service `yaml:"-"`
Debug Debug `yaml:"debug"`
TokenManager *TokenManager `yaml:"token_manager"`
Events Events `yaml:"events"`
Reva *shared.Reva `yaml:"reva"`
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
Context context.Context `yaml:"-"`
Log *Log `yaml:"log"`
Engine Engine `yaml:"engine"`
Postprocessing Postprocessing `yaml:"postprocessing"`
Tracing *Tracing `yaml:"tracing"`
}

// Service defines the available service configuration.
Expand Down
1 change: 0 additions & 1 deletion services/policies/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func EnsureDefaults(cfg *config.Config) {
cfg.TokenManager = &config.TokenManager{}
}


if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
cfg.Reva = &shared.Reva{
Address: cfg.Commons.Reva.Address,
Expand Down
91 changes: 47 additions & 44 deletions services/proxy/pkg/proxy/policy/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,29 @@ const (
// Selector is a function which selects a proxy-policy based on the request.
//
// A policy is a random name which identifies a set of proxy-routes:
//{
// "policies": [
// {
// "name": "us-east-1",
// "routes": [
// {
// "endpoint": "/",
// "backend": "https://backend.us.example.com:8080/app"
// }
// ]
// },
// {
// "name": "eu-ams-1",
// "routes": [
// {
// "endpoint": "/",
// "backend": "https://backend.eu.example.com:8080/app"
// }
// ]
// }
// ]
//}
//
// {
// "policies": [
// {
// "name": "us-east-1",
// "routes": [
// {
// "endpoint": "/",
// "backend": "https://backend.us.example.com:8080/app"
// }
// ]
// },
// {
// "name": "eu-ams-1",
// "routes": [
// {
// "endpoint": "/",
// "backend": "https://backend.eu.example.com:8080/app"
// }
// ]
// }
// ]
// }
type Selector func(r *http.Request) (string, error)

// LoadSelector constructs a specific policy-selector from a given configuration
Expand Down Expand Up @@ -97,9 +98,9 @@ func LoadSelector(cfg *config.PolicySelector) (Selector, error) {
//
// Configuration:
//
// "policy_selector": {
// "static": {"policy" : "ocis"}
// },
// "policy_selector": {
// "static": {"policy" : "ocis"}
// },
func NewStaticSelector(cfg *config.StaticSelectorConf) Selector {
return func(r *http.Request) (s string, err error) {
return cfg.Policy, nil
Expand All @@ -108,12 +109,13 @@ func NewStaticSelector(cfg *config.StaticSelectorConf) Selector {

// NewClaimsSelector selects the policy based on the "ocis.routing.policy" claim
// The policy for corner cases is configurable:
// "policy_selector": {
// "migration": {
// "default_policy" : "ocis",
// "unauthenticated_policy": "oc10"
// }
// },
//
// "policy_selector": {
// "migration": {
// "default_policy" : "ocis",
// "unauthenticated_policy": "oc10"
// }
// },
//
// This selector can be used in migration-scenarios where some users have already migrated from ownCloud10 to OCIS and
func NewClaimsSelector(cfg *config.ClaimsSelectorConf) Selector {
Expand Down Expand Up @@ -154,19 +156,20 @@ func NewClaimsSelector(cfg *config.ClaimsSelectorConf) Selector {

// NewRegexSelector selects the policy based on a user property
// The policy for each case is configurable:
// "policy_selector": {
// "regex": {
// "matches_policies": [
// {"priority": 10, "property": "mail", "match": "marie@example.org", "policy": "ocis"},
// {"priority": 20, "property": "mail", "match": "[^@]+@example.org", "policy": "oc10"},
// {"priority": 30, "property": "username", "match": "(einstein|feynman)", "policy": "ocis"},
// {"priority": 40, "property": "username", "match": ".+", "policy": "oc10"},
// {"priority": 50, "property": "id", "match": "4c510ada-c86b-4815-8820-42cdf82c3d51", "policy": "ocis"},
// {"priority": 60, "property": "id", "match": "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c", "policy": "oc10"}
// ],
// "unauthenticated_policy": "oc10"
// }
// },
//
// "policy_selector": {
// "regex": {
// "matches_policies": [
// {"priority": 10, "property": "mail", "match": "marie@example.org", "policy": "ocis"},
// {"priority": 20, "property": "mail", "match": "[^@]+@example.org", "policy": "oc10"},
// {"priority": 30, "property": "username", "match": "(einstein|feynman)", "policy": "ocis"},
// {"priority": 40, "property": "username", "match": ".+", "policy": "oc10"},
// {"priority": 50, "property": "id", "match": "4c510ada-c86b-4815-8820-42cdf82c3d51", "policy": "ocis"},
// {"priority": 60, "property": "id", "match": "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c", "policy": "oc10"}
// ],
// "unauthenticated_policy": "oc10"
// }
// },
//
// This selector can be used in migration-scenarios where some users have already migrated from ownCloud10 to OCIS and
func NewRegexSelector(cfg *config.RegexSelectorConf) Selector {
Expand Down
1 change: 1 addition & 0 deletions services/thumbnails/pkg/preprocessor/fontloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type FontLoader struct {
// Note that only the fonts described in the fontMapFile will be used.
//
// The fontMapFile has the following structure
//
// {
// "fontMap": {
// "Han": "packaged/myFont-CJK.otf",
Expand Down
Loading

0 comments on commit c12c8f3

Please sign in to comment.