Skip to content

Commit

Permalink
update service file
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Feb 2, 2024
1 parent d723f6d commit ff51917
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
14 changes: 8 additions & 6 deletions cmds/liter-server/api_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ func checkTokenId(id string) (ok bool) {
}

func (s *Server) checkToken(ctx *gin.Context, token string) (ok bool) {
t, err := jwt.Parse(token, func(t *jwt.Token) (interface{}, error) {
if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, fmt.Errorf("Unexpected signing method: %v", t.Header["alg"])
}
return s.hmacKey, nil
},
t, err := jwt.Parse(
token,
func(t *jwt.Token) (interface{}, error) {
if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, fmt.Errorf("Unexpected signing method: %v", t.Header["alg"])
}
return s.hmacKey, nil
},
jwt.WithSubject("optk"),
jwt.WithIssuedAt(),
jwt.WithIssuer(jwtIssuer),
Expand Down
9 changes: 5 additions & 4 deletions cmds/liter-server/litermc.service
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
[Unit]
Description=A reverse proxy for minecraft server
After=network.target nss-lookup.target
Documentation=https://github.com/kmcsr/go-liter
Requires=network.target nss-lookup.target

[Service]
Type=forking
PIDFile=/var/run/litermc.pid
WorkingDirectory=/opt/litermc
ExecStart=/usr/sbin/litermc daemon /var/run/litermc.pid
ExecReload=/usr/sbin/litermc reload /var/run/litermc.pid
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /var/run/litermc.pid
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry TERM/5 --pidfile /var/run/litermc.pid
TimeoutStopSec=10
KillMode=mixed
Restart=on-failure
RestartSec=5
RestartSec=10

[Install]
WantedBy=multi-user.target
Alias=litermc.service
Alias=litermc

0 comments on commit ff51917

Please sign in to comment.