mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-05 19:09:56 -05:00
add requestID middleware (#4974)
* add requestID middleware * Update services/ocdav/pkg/config/config.go * remove unnecessary config structs Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> Co-authored-by: Jörn Friedrich Dreyer <jfd@owncloud.com> Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
@@ -3,3 +3,4 @@ Enhancement: Logging improvements
|
||||
We improved the logging of several http services. If possible and present, we now log the `X-Request-Id`.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/4815
|
||||
https://github.com/owncloud/ocis/pull/4974
|
||||
|
||||
@@ -99,6 +99,7 @@ func FrontendConfigFromStruct(cfg *config.Config) (map[string]interface{}, error
|
||||
"namespace": "ocis",
|
||||
"subsystem": "frontend",
|
||||
},
|
||||
"requestid": map[string]interface{}{},
|
||||
},
|
||||
// TODO build services dynamically
|
||||
"services": map[string]interface{}{
|
||||
|
||||
@@ -29,8 +29,7 @@ type Config struct {
|
||||
// Insecure certificates allowed when making requests to the gateway
|
||||
Insecure bool `yaml:"insecure" env:"OCIS_INSECURE;OCDAV_INSECURE" desc:"Allow insecure connections to the GATEWAY service."`
|
||||
// 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."`
|
||||
Middleware Middleware `yaml:"middleware"`
|
||||
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."`
|
||||
|
||||
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;OCDAV_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary for the access to resources from other services."`
|
||||
|
||||
@@ -69,16 +68,6 @@ type HTTPConfig struct {
|
||||
Prefix string `yaml:"prefix" env:"OCDAV_HTTP_PREFIX" desc:"A URL path prefix for the handler."`
|
||||
}
|
||||
|
||||
// Middleware configures reva middlewares.
|
||||
type Middleware struct {
|
||||
Auth Auth `yaml:"auth"`
|
||||
}
|
||||
|
||||
// Auth configures reva http auth middleware.
|
||||
type Auth struct {
|
||||
CredentialsByUserAgent map[string]string `yaml:"credentials_by_user_agent"`
|
||||
}
|
||||
|
||||
// Status holds the configurable values for the status.php
|
||||
type Status struct {
|
||||
Version string
|
||||
|
||||
@@ -30,18 +30,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,
|
||||
Middleware: config.Middleware{
|
||||
Auth: config.Auth{
|
||||
CredentialsByUserAgent: map[string]string{},
|
||||
},
|
||||
},
|
||||
Reva: shared.DefaultRevaConfig(),
|
||||
WebdavNamespace: "/users/{{.Id.OpaqueId}}",
|
||||
FilesNamespace: "/users/{{.Id.OpaqueId}}",
|
||||
SharesNamespace: "/Shares",
|
||||
PublicURL: "https://localhost:9200",
|
||||
Insecure: false,
|
||||
Timeout: 84300,
|
||||
MachineAuthAPIKey: "",
|
||||
Status: config.Status{
|
||||
Version: version.Legacy,
|
||||
|
||||
@@ -57,6 +57,9 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
"http": map[string]interface{}{
|
||||
"network": cfg.HTTP.Protocol,
|
||||
"address": cfg.HTTP.Addr,
|
||||
"middlewares": map[string]interface{}{
|
||||
"requestid": map[string]interface{}{},
|
||||
},
|
||||
// TODO build services dynamically
|
||||
"services": map[string]interface{}{
|
||||
"dataprovider": map[string]interface{}{
|
||||
|
||||
Reference in New Issue
Block a user