Revert "fix code smells"

This reverts commit a22342ea28.
This commit is contained in:
A.Unger
2021-11-15 10:16:20 +01:00
parent a22342ea28
commit 2b0f414b46
3 changed files with 28 additions and 32 deletions

View File

@@ -256,10 +256,6 @@ func DefaultConfig() *Config {
}
func defaultPolicies() []Policy {
const idpBackend = "http://localhost:9130"
const revaBackend = "http://localhost:9140"
const namedDemoBackend = "https://demo.owncloud.com"
return []Policy{
{
Name: "ocis",
@@ -270,19 +266,19 @@ func defaultPolicies() []Policy {
},
{
Endpoint: "/.well-known/",
Backend: idpBackend,
Backend: "http://localhost:9130",
},
{
Endpoint: "/konnect/",
Backend: idpBackend,
Backend: "http://localhost:9130",
},
{
Endpoint: "/signin/",
Backend: idpBackend,
Backend: "http://localhost:9130",
},
{
Endpoint: "/archiver",
Backend: revaBackend,
Backend: "http://localhost:9140",
},
{
Type: RegexRoute,
@@ -291,7 +287,7 @@ func defaultPolicies() []Policy {
},
{
Endpoint: "/ocs/",
Backend: revaBackend,
Backend: "http://localhost:9140",
},
{
Type: QueryRoute,
@@ -300,31 +296,31 @@ func defaultPolicies() []Policy {
},
{
Endpoint: "/remote.php/",
Backend: revaBackend,
Backend: "http://localhost:9140",
},
{
Endpoint: "/dav/",
Backend: revaBackend,
Backend: "http://localhost:9140",
},
{
Endpoint: "/webdav/",
Backend: revaBackend,
Backend: "http://localhost:9140",
},
{
Endpoint: "/status.php",
Backend: revaBackend,
Backend: "http://localhost:9140",
},
{
Endpoint: "/index.php/",
Backend: revaBackend,
Backend: "http://localhost:9140",
},
{
Endpoint: "/data",
Backend: revaBackend,
Backend: "http://localhost:9140",
},
{
Endpoint: "/app/",
Backend: revaBackend,
Backend: "http://localhost:9140",
},
{
Endpoint: "/graph/",
@@ -339,6 +335,7 @@ func defaultPolicies() []Policy {
Endpoint: "/api/v0/accounts",
Backend: "http://localhost:9181",
},
// TODO the lookup needs a better mechanism
{
Endpoint: "/accounts.js",
Backend: "http://localhost:9181",
@@ -362,53 +359,53 @@ func defaultPolicies() []Policy {
},
{
Endpoint: "/.well-known/",
Backend: idpBackend,
Backend: "http://localhost:9130",
},
{
Endpoint: "/konnect/",
Backend: idpBackend,
Backend: "http://localhost:9130",
},
{
Endpoint: "/signin/",
Backend: idpBackend,
Backend: "http://localhost:9130",
},
{
Endpoint: "/archiver",
Backend: revaBackend,
Backend: "http://localhost:9140",
},
{
Endpoint: "/ocs/",
Backend: namedDemoBackend,
Backend: "https://demo.owncloud.com",
ApacheVHost: true,
},
{
Endpoint: "/remote.php/",
Backend: namedDemoBackend,
Backend: "https://demo.owncloud.com",
ApacheVHost: true,
},
{
Endpoint: "/dav/",
Backend: namedDemoBackend,
Backend: "https://demo.owncloud.com",
ApacheVHost: true,
},
{
Endpoint: "/webdav/",
Backend: namedDemoBackend,
Backend: "https://demo.owncloud.com",
ApacheVHost: true,
},
{
Endpoint: "/status.php",
Backend: namedDemoBackend,
Backend: "https://demo.owncloud.com",
ApacheVHost: true,
},
{
Endpoint: "/index.php/",
Backend: namedDemoBackend,
Backend: "https://demo.owncloud.com",
ApacheVHost: true,
},
{
Endpoint: "/data",
Backend: namedDemoBackend,
Backend: "https://demo.owncloud.com",
ApacheVHost: true,
},
},

View File

@@ -27,12 +27,10 @@ func Server(opts ...Option) (*http.Server, error) {
), nil
}
const contentTypeHeader = "Content-Type"
// health implements the health check.
func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set(contentTypeHeader, "text/plain")
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
// TODO(tboerger): check if services are up and running
@@ -46,7 +44,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
// ready implements the ready check.
func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set(contentTypeHeader, "text/plain")
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
// TODO(tboerger): check if services are up and running
@@ -60,7 +58,7 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
// configDump implements the config dump
func configDump(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set(contentTypeHeader, "application/json")
w.Header().Set("Content-Type", "application/json")
b, err := json.Marshal(cfg)
if err != nil {

View File

@@ -220,6 +220,7 @@ type StorageConfig struct {
S3 DriverS3
S3NG DriverS3NG
OCIS DriverOCIS
// TODO checksums ... figure out what that is supposed to do
}
// DriverCommon defines common driver configuration options.