diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-04-12 22:52:49 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2023-09-25 09:43:37 +0200 |
| commit | a23c3e61c5d89ef67973891b5b3a176c06e1b174 (patch) | |
| tree | f1eed03b047f8affd3d5123fa5c9e868ac7d8bec /internal/server/custom.go | |
| parent | ee95eb45708e1fa766a63866d26d05d13f23e8c9 (diff) | |
Refactor: Split internal server into multiple packages
- Pass contexts
- Have separate packages for e.g. custom, institute and secure
- internet servers, profiles....
- Return types from the public ./types package with a Public() method
Diffstat (limited to 'internal/server/custom.go')
| -rw-r--r-- | internal/server/custom.go | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/internal/server/custom.go b/internal/server/custom.go deleted file mode 100644 index 6171e24..0000000 --- a/internal/server/custom.go +++ /dev/null @@ -1,35 +0,0 @@ -package server - -import ( - "github.com/go-errors/errors" -) - -func (ss *Servers) SetCustomServer(server Server) error { - b, err := server.Base() - if err != nil { - return err - } - - if b.Type != "custom_server" { - return errors.New("not a custom server") - } - - if _, ok := ss.CustomServers.Map[b.URL]; ok { - ss.CustomServers.CurrentURL = b.URL - ss.IsType = CustomServerType - } else { - return errors.Errorf("this server is not yet added as a custom server: %s", b.URL) - } - return nil -} - -func (ss *Servers) GetCustomServer(url string) (*InstituteAccessServer, error) { - if srv, ok := ss.CustomServers.Map[url]; ok { - return srv, nil - } - return nil, errors.Errorf("failed to get institute access server - no custom server with URL '%s'", url) -} - -func (ss *Servers) RemoveCustomServer(url string) { - ss.CustomServers.Remove(url) -} |
