From f49930c514773107da1c205da7245ee23df19d43 Mon Sep 17 00:00:00 2001 From: Sean Reifschneider Date: Fri, 3 Mar 2023 06:55:29 -0700 Subject: [PATCH] Add "configtest" CLI command. (#1230) Co-authored-by: Kristoffer Dalby Fixes https://github.com/juanfont/headscale/issues/1229 --- CHANGELOG.md | 2 ++ cmd/headscale/cli/configtest.go | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 cmd/headscale/cli/configtest.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f7e7b7a..70c3f5f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### changes +- Adding "configtest" CLI command. + ## 0.20.0 (2023-02-03) ### changes diff --git a/cmd/headscale/cli/configtest.go b/cmd/headscale/cli/configtest.go new file mode 100644 index 00000000..37b77848 --- /dev/null +++ b/cmd/headscale/cli/configtest.go @@ -0,0 +1,22 @@ +package cli + +import ( + "github.com/spf13/cobra" + "github.com/rs/zerolog/log" +) + +func init() { + rootCmd.AddCommand(configTestCmd) +} + +var configTestCmd = &cobra.Command{ + Use: "configtest", + Short: "Test the configuration.", + Long: "Run a test of the configuration and exit.", + Run: func(cmd *cobra.Command, args []string) { + _, err := getHeadscaleApp() + if err != nil { + log.Fatal().Caller().Err(err).Msg("Error initializing") + } + }, +}