mirror of
https://github.com/juanfont/headscale.git
synced 2026-02-07 20:04:00 +01:00
Go style recommends that log messages and error strings should not be capitalized (unless beginning with proper nouns or acronyms) and should not end with punctuation. This change normalizes all zerolog .Msg() and .Msgf() calls to start with lowercase letters, following Go conventions and making logs more consistent across the codebase.
41 lines
879 B
Go
41 lines
879 B
Go
package cli
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
"github.com/spf13/cobra"
|
|
"github.com/tailscale/squibble"
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(serveCmd)
|
|
}
|
|
|
|
var serveCmd = &cobra.Command{
|
|
Use: "serve",
|
|
Short: "Launches the headscale server",
|
|
Args: func(cmd *cobra.Command, args []string) error {
|
|
return nil
|
|
},
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
app, err := newHeadscaleServerWithConfig()
|
|
if err != nil {
|
|
var squibbleErr squibble.ValidationError
|
|
if errors.As(err, &squibbleErr) {
|
|
fmt.Printf("SQLite schema failed to validate:\n")
|
|
fmt.Println(squibbleErr.Diff)
|
|
}
|
|
|
|
log.Fatal().Caller().Err(err).Msg("error initializing")
|
|
}
|
|
|
|
err = app.Serve()
|
|
if err != nil && !errors.Is(err, http.ErrServerClosed) {
|
|
log.Fatal().Caller().Err(err).Msg("headscale ran into an error and had to shut down")
|
|
}
|
|
},
|
|
}
|