summaryrefslogtreecommitdiff
path: root/internal/config/v2/convert.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-02-12 19:18:05 +0100
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-02-19 14:15:07 +0100
commit74e36f0ead717105f26087c2cab08b41ba5a7ce8 (patch)
tree1eb2b7516bea705c9b5a50ce0965e170414ed880 /internal/config/v2/convert.go
parent682d70091af2044ff6d8b350da9dff13163232e2 (diff)
All: Document everything to pass revive lint
Diffstat (limited to 'internal/config/v2/convert.go')
-rw-r--r--internal/config/v2/convert.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/config/v2/convert.go b/internal/config/v2/convert.go
index 0212749..21f39a9 100644
--- a/internal/config/v2/convert.go
+++ b/internal/config/v2/convert.go
@@ -15,11 +15,11 @@ func v1AuthTime(st time.Time, ost time.Time) time.Time {
return ost
}
-func convertV1Server(list v1.InstituteServers, iscurrent bool, t server.Type) (map[ServerType]*Server, *ServerType) {
- ret := make(map[ServerType]*Server)
- var lc *ServerType
+func convertV1Server(list v1.InstituteServers, iscurrent bool, t server.Type) (map[ServerKey]*Server, *ServerKey) {
+ ret := make(map[ServerKey]*Server)
+ var lc *ServerKey
for k, v := range list.Map {
- key := ServerType{
+ key := ServerKey{
T: t,
ID: k,
}
@@ -37,10 +37,11 @@ func convertV1Server(list v1.InstituteServers, iscurrent bool, t server.Type) (m
return ret, lc
}
+// FromV1 converts a version 1 state struct into a v2 one
func FromV1(ver1 *v1.V1) *V2 {
gsrvs := ver1.Servers
- var lc *ServerType
+ var lc *ServerKey
cust, glc := convertV1Server(gsrvs.Custom, gsrvs.IsType == server.TypeCustom, server.TypeCustom)
if lc == nil {
lc = glc
@@ -64,7 +65,7 @@ func FromV1(ver1 *v1.V1) *V2 {
}
v, ok := sec.BaseMap[sec.CurrentLocation]
if v != nil && ok {
- t := ServerType{
+ t := ServerKey{
T: server.TypeSecureInternet,
ID: sec.HomeOrganizationID,
}