WIP: context for clean shutdown

This commit is contained in:
Christoph Haas
2021-02-22 22:25:08 +01:00
parent 984f744548
commit 43bab58f0a
2 changed files with 31 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package server
import (
"context"
"encoding/gob"
"errors"
"html/template"
@@ -64,6 +65,7 @@ type StaticData struct {
type Server struct {
// Core components
ctx context.Context
config *common.Config
server *gin.Engine
users *UserManager
@@ -79,7 +81,7 @@ type Server struct {
ldapCacheUpdater *ldap.UserCache
}
func (s *Server) Setup() error {
func (s *Server) Setup(ctx context.Context) error {
dir := s.getExecutableDirectory()
rDir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
logrus.Infof("Real working directory: %s", rDir)