Skip to content

Commit

Permalink
Revert "SQL Backend (#11048)"
Browse files Browse the repository at this point in the history
This reverts commit 06fef2a.
  • Loading branch information
espadolini authored and github-actions committed Oct 7, 2022
1 parent 54460a2 commit feaae50
Show file tree
Hide file tree
Showing 18 changed files with 5 additions and 3,036 deletions.
34 changes: 2 additions & 32 deletions lib/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (
"strings"
"time"

"github.com/gravitational/teleport/api/types"
"github.com/gravitational/trace"

"github.com/jonboulle/clockwork"

"github.com/gravitational/teleport/api/types"
)

// Forever means that object TTL will not expire unless deleted
Expand Down Expand Up @@ -232,36 +232,6 @@ func (p Params) GetString(key string) string {
return s
}

// Cleanse fixes an issue with yamlv2 decoding nested sections to
// map[interface{}]interface{} rather than map[string]interface{}.
// ObjectToStruct will fail on the former. yamlv3 corrects this behavior.
// All non-string keys are dropped.
func (p Params) Cleanse() {
for key, value := range p {
if mapValue, ok := value.(map[interface{}]interface{}); ok {
p[key] = convertParams(mapValue)
}
}
}

// convertParams converts from a map[interface{}]interface{} to
// map[string]interface{} recursively. All non-string keys are dropped.
// This function is called by Params.Cleanse.
func convertParams(from map[interface{}]interface{}) (to map[string]interface{}) {
to = make(map[string]interface{}, len(from))
for key, value := range from {
strKey, ok := key.(string)
if !ok {
continue
}
if mapValue, ok := value.(map[interface{}]interface{}); ok {
value = convertParams(mapValue)
}
to[strKey] = value
}
return to
}

// NoLimit specifies no limits
const NoLimit = 0

Expand Down
25 changes: 0 additions & 25 deletions lib/backend/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,3 @@ func TestRangeEnd(t *testing.T) {
})
}
}

func TestParamsCleanse(t *testing.T) {
source := Params{
"Addr": "localhost:345",
"TLS": map[interface{}]interface{}{
"CAFile": "/path/to/file",
"Certs": map[interface{}]interface{}{
"Cert": "cert.crt",
"Key": "key.crt",
},
},
}
expect := Params{
"Addr": "localhost:345",
"TLS": map[string]interface{}{
"CAFile": "/path/to/file",
"Certs": map[string]interface{}{
"Cert": "cert.crt",
"Key": "key.crt",
},
},
}
source.Cleanse()
require.Equal(t, source, expect)
}
165 changes: 0 additions & 165 deletions lib/backend/postgres/backend.go

This file was deleted.

Loading

0 comments on commit feaae50

Please sign in to comment.