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:
co-authored by
Jörn Friedrich Dreyer
Jörn Friedrich Dreyer
parent
753812bf63
commit
6c2a1999c4
@@ -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`.
|
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/4815
|
||||||
|
https://github.com/owncloud/ocis/pull/4974
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ func FrontendConfigFromStruct(cfg *config.Config) (map[string]interface{}, error
|
|||||||
"namespace": "ocis",
|
"namespace": "ocis",
|
||||||
"subsystem": "frontend",
|
"subsystem": "frontend",
|
||||||
},
|
},
|
||||||
|
"requestid": map[string]interface{}{},
|
||||||
},
|
},
|
||||||
// TODO build services dynamically
|
// TODO build services dynamically
|
||||||
"services": map[string]interface{}{
|
"services": map[string]interface{}{
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ type Config struct {
|
|||||||
// Insecure certificates allowed when making requests to the gateway
|
// 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."`
|
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 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."`
|
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"`
|
|
||||||
|
|
||||||
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."`
|
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."`
|
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
|
// Status holds the configurable values for the status.php
|
||||||
type Status struct {
|
type Status struct {
|
||||||
Version string
|
Version string
|
||||||
|
|||||||
@@ -30,18 +30,13 @@ func DefaultConfig() *config.Config {
|
|||||||
Service: config.Service{
|
Service: config.Service{
|
||||||
Name: "ocdav",
|
Name: "ocdav",
|
||||||
},
|
},
|
||||||
Reva: shared.DefaultRevaConfig(),
|
Reva: shared.DefaultRevaConfig(),
|
||||||
WebdavNamespace: "/users/{{.Id.OpaqueId}}",
|
WebdavNamespace: "/users/{{.Id.OpaqueId}}",
|
||||||
FilesNamespace: "/users/{{.Id.OpaqueId}}",
|
FilesNamespace: "/users/{{.Id.OpaqueId}}",
|
||||||
SharesNamespace: "/Shares",
|
SharesNamespace: "/Shares",
|
||||||
PublicURL: "https://localhost:9200",
|
PublicURL: "https://localhost:9200",
|
||||||
Insecure: false,
|
Insecure: false,
|
||||||
Timeout: 84300,
|
Timeout: 84300,
|
||||||
Middleware: config.Middleware{
|
|
||||||
Auth: config.Auth{
|
|
||||||
CredentialsByUserAgent: map[string]string{},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MachineAuthAPIKey: "",
|
MachineAuthAPIKey: "",
|
||||||
Status: config.Status{
|
Status: config.Status{
|
||||||
Version: version.Legacy,
|
Version: version.Legacy,
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
|||||||
"http": map[string]interface{}{
|
"http": map[string]interface{}{
|
||||||
"network": cfg.HTTP.Protocol,
|
"network": cfg.HTTP.Protocol,
|
||||||
"address": cfg.HTTP.Addr,
|
"address": cfg.HTTP.Addr,
|
||||||
|
"middlewares": map[string]interface{}{
|
||||||
|
"requestid": map[string]interface{}{},
|
||||||
|
},
|
||||||
// TODO build services dynamically
|
// TODO build services dynamically
|
||||||
"services": map[string]interface{}{
|
"services": map[string]interface{}{
|
||||||
"dataprovider": map[string]interface{}{
|
"dataprovider": map[string]interface{}{
|
||||||
|
|||||||
Reference in New Issue
Block a user