Register cmd under node

This commit is contained in:
Juan Font Alonso 2021-05-01 20:05:10 +02:00
parent c71c13366f
commit 45e9001787
3 changed files with 5 additions and 9 deletions

View file

@ -78,7 +78,7 @@ Suggestions/PRs welcomed!
8. In the server, register your machine to a namespace with the CLI 8. In the server, register your machine to a namespace with the CLI
```shell ```shell
./headscale -n myfirstnamespace register YOURMACHINEKEY ./headscale -n myfirstnamespace node register YOURMACHINEKEY
``` ```
## Configuration reference ## Configuration reference

2
api.go
View file

@ -43,7 +43,7 @@ func (h *Headscale) RegisterWebAPI(c *gin.Context) {
<p> <p>
<code> <code>
<b>headscale register %s</b> <b>headscale -n NAMESPACE node register %s</b>
</code> </code>
</p> </p>

View file

@ -86,7 +86,6 @@ func main() {
headscaleCmd.AddCommand(cli.NamespaceCmd) headscaleCmd.AddCommand(cli.NamespaceCmd)
headscaleCmd.AddCommand(cli.NodeCmd) headscaleCmd.AddCommand(cli.NodeCmd)
headscaleCmd.AddCommand(cli.PreauthkeysCmd) headscaleCmd.AddCommand(cli.PreauthkeysCmd)
headscaleCmd.AddCommand(cli.RegisterCmd)
headscaleCmd.AddCommand(cli.RoutesCmd) headscaleCmd.AddCommand(cli.RoutesCmd)
headscaleCmd.AddCommand(cli.ServeCmd) headscaleCmd.AddCommand(cli.ServeCmd)
headscaleCmd.AddCommand(versionCmd) headscaleCmd.AddCommand(versionCmd)
@ -103,12 +102,6 @@ func main() {
log.Fatalf(err.Error()) log.Fatalf(err.Error())
} }
cli.RegisterCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace")
err = cli.RegisterCmd.MarkPersistentFlagRequired("namespace")
if err != nil {
log.Fatalf(err.Error())
}
cli.RoutesCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace") cli.RoutesCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace")
err = cli.RoutesCmd.MarkPersistentFlagRequired("namespace") err = cli.RoutesCmd.MarkPersistentFlagRequired("namespace")
if err != nil { if err != nil {
@ -118,6 +111,9 @@ func main() {
cli.NamespaceCmd.AddCommand(cli.CreateNamespaceCmd) cli.NamespaceCmd.AddCommand(cli.CreateNamespaceCmd)
cli.NamespaceCmd.AddCommand(cli.ListNamespacesCmd) cli.NamespaceCmd.AddCommand(cli.ListNamespacesCmd)
cli.NodeCmd.AddCommand(cli.ListNodesCmd)
cli.NodeCmd.AddCommand(cli.RegisterCmd)
cli.RoutesCmd.AddCommand(cli.ListRoutesCmd) cli.RoutesCmd.AddCommand(cli.ListRoutesCmd)
cli.RoutesCmd.AddCommand(cli.EnableRouteCmd) cli.RoutesCmd.AddCommand(cli.EnableRouteCmd)