use the new defaultFrontend config in the 'share public' command (#663)

This commit is contained in:
Michael Quigley 2024-06-21 10:20:53 -04:00
parent e3dec09284
commit e82026e067
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 7 additions and 2 deletions

View File

@ -46,7 +46,7 @@ func (cmd *configUnsetCommand) run(_ *cobra.Command, args []string) {
case "defaultFrontend": case "defaultFrontend":
cfg.DefaultFrontend = "" cfg.DefaultFrontend = ""
default: default:
fmt.Printf("unknown config name '%v'\n", configName) fmt.Printf("unknown config name '%v'\n", configName)
os.Exit(1) os.Exit(1)

View File

@ -45,7 +45,12 @@ func newSharePublicCommand() *sharePublicCommand {
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
} }
command := &sharePublicCommand{cmd: cmd} command := &sharePublicCommand{cmd: cmd}
cmd.Flags().StringArrayVar(&command.frontendSelection, "frontend", []string{"public|<defaultFrontend>"}, "Selected frontends to use for the share") defaultFrontends := []string{"public"}
if root, err := environment.LoadRoot(); err == nil {
defaultFrontend, _ := root.DefaultFrontend()
defaultFrontends = []string{defaultFrontend}
}
cmd.Flags().StringArrayVar(&command.frontendSelection, "frontend", defaultFrontends, "Selected frontends to use for the share")
cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode {proxy, web, caddy, drive}") cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode {proxy, web, caddy, drive}")
cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless") cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless")
cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for <target>") cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for <target>")