Newer
Older
"os"
"os/signal"
"syscall"
log "github.com/sirupsen/logrus"
"github.com/oidc-mytoken/server/internal/config"
"github.com/oidc-mytoken/server/internal/db"
configurationEndpoint "github.com/oidc-mytoken/server/internal/endpoints/configuration"
"github.com/oidc-mytoken/server/internal/jws"
"github.com/oidc-mytoken/server/internal/oidc/authcode"
"github.com/oidc-mytoken/server/internal/server"
"github.com/oidc-mytoken/server/internal/utils/geoip"
loggerUtils "github.com/oidc-mytoken/server/internal/utils/logger"
"github.com/oidc-mytoken/server/shared/httpClient"
configurationEndpoint.Init()
authcode.Init()
if err := db.Connect(); err != nil {
}
jws.LoadKey()
httpClient.Init(config.Get().IssuerURL)
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
func handleSignals() {
signals := make(chan os.Signal)
signal.Notify(signals, syscall.SIGHUP, syscall.SIGUSR1)
go func() {
for {
sig := <-signals
switch sig {
case syscall.SIGHUP:
reload()
case syscall.SIGUSR1:
reloadLogFiles()
}
}
}()
}
func reload() {
log.Info("Reloading config")
config.Load()
loggerUtils.SetOutput()
loggerUtils.MustUpdateAccessLogger()
if err := db.Connect(); err != nil {
log.WithError(err).Fatal()
}
jws.LoadKey()
geoip.Init()
}
func reloadLogFiles() {
log.Debug("Reloading log files")
loggerUtils.SetOutput()
loggerUtils.MustUpdateAccessLogger()
}