1package cmd
2
3import (
4 "github.com/charmbracelet/soft-serve/proto"
5 "github.com/spf13/cobra"
6)
7
8// ReloadCommand returns a command that reloads the server configuration.
9func ReloadCommand() *cobra.Command {
10 reloadCmd := &cobra.Command{
11 Use: "reload",
12 Short: "Reloads the configuration",
13 RunE: func(cmd *cobra.Command, args []string) error {
14 ac, s := fromContext(cmd)
15 auth := ac.AuthRepo("config", s.PublicKey())
16 if auth < proto.AdminAccess {
17 return ErrUnauthorized
18 }
19 return ac.Reload()
20 },
21 }
22 return reloadCmd
23}