Only load needed part of configuration (#2109)

This commit is contained in:
Kristoffer Dalby
2024-09-07 09:23:58 +02:00
committed by GitHub
parent f368ed01ed
commit 8a3a0fee3c
18 changed files with 196 additions and 324 deletions

View File

@@ -0,0 +1,29 @@
package cli
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
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 {
log.Fatal().Caller().Err(err).Msg("Error initializing")
}
err = app.Serve()
if err != nil {
log.Fatal().Caller().Err(err).Msg("Error starting server")
}
},
}