feat: Support Bearer token for clients
All checks were successful
/ pre-commit (push) Successful in 1m39s
All checks were successful
/ pre-commit (push) Successful in 1m39s
Fixes #13. Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
d3b28143ea
commit
b45c3e3253
4 changed files with 83 additions and 50 deletions
|
@ -3,6 +3,7 @@ package internal
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -99,3 +100,12 @@ func HumanDuration(i int) string {
|
|||
}
|
||||
return fmt.Sprintf("%d %s", i, w)
|
||||
}
|
||||
|
||||
func ReturnError(logger *slog.Logger, message string, err error) int {
|
||||
if err != nil {
|
||||
logger.Error(message, slog.Any("error", err))
|
||||
} else {
|
||||
logger.Error(message)
|
||||
}
|
||||
return RC_ERROR
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue