Skip to content

Commit

Permalink
basic config support for default frontend (#663)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelquigley committed Jun 20, 2024
1 parent 2a21a67 commit 671d1aa
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

FEATURE: New permission mode support for public frontends. Open permission mode frontends are available to all users in the service instance. Closed permission mode frontends reference the new `frontend_grants` table that can be used to control which accounts are allowed to create shares using that frontend. `zrok admin create frontend` now supports `--closed` flag to create closed permission mode frontends (https://github.com/openziti/zrok/issues/539)

FEATURE: New config `defaultFrontend` that specifies the default frontend to be used for an environment (https://github.com/openziti/zrok/issues/663)

FEATURE: Resource count limits now include `share_frontends` to limit the number of frontends that are allowed to make connections to a share (https://github.com/openziti/zrok/issues/650)

FIX: use controller config spec v4 in the Docker instance
Expand Down
2 changes: 1 addition & 1 deletion cmd/zrok/sharePublic.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func newSharePublicCommand() *sharePublicCommand {
Args: cobra.ExactArgs(1),
}
command := &sharePublicCommand{cmd: cmd}
cmd.Flags().StringArrayVar(&command.frontendSelection, "frontends", []string{"public"}, "Selected frontends to use for the share")
cmd.Flags().StringArrayVar(&command.frontendSelection, "frontend", []string{"public|<defaultFrontend>"}, "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().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless")
cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for <target>")
Expand Down
4 changes: 3 additions & 1 deletion environment/env_core/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Root interface {

Client() (*rest_client_zrok.Zrok, error)
ApiEndpoint() (string, string)
DefaultFrontend() (string, string)

IsEnabled() bool
Environment() *Environment
Expand All @@ -34,7 +35,8 @@ type Environment struct {
}

type Config struct {
ApiEndpoint string
ApiEndpoint string
DefaultFrontend string
}

type Metadata struct {
Expand Down
18 changes: 18 additions & 0 deletions environment/env_v0_3/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,24 @@ func (r *Root) ApiEndpoint() (string, string) {
return apiEndpoint, from
}

func (r *Root) DefaultFrontend() (string, string) {
defaultFrontend := "public"
from := "binary"

if r.Config() != nil && r.Config().DefaultFrontend != "" {
defaultFrontend = r.Config().DefaultFrontend
from = "config"
}

env := os.Getenv("ZROK_DEFAULT_FRONTEND")
if env != "" {
defaultFrontend = env
from = "ZROK_DEFAULT_FRONTEND"
}

return defaultFrontend, from
}

func (r *Root) Environment() *env_core.Environment {
return r.env
}
Expand Down
18 changes: 18 additions & 0 deletions environment/env_v0_4/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,24 @@ func (r *Root) ApiEndpoint() (string, string) {
return apiEndpoint, from
}

func (r *Root) DefaultFrontend() (string, string) {
defaultFrontend := "public"
from := "binary"

if r.Config() != nil && r.Config().DefaultFrontend != "" {
defaultFrontend = r.Config().DefaultFrontend
from = "config"
}

env := os.Getenv("ZROK_DEFAULT_FRONTEND")
if env != "" {
defaultFrontend = env
from = "ZROK_DEFAULT_FRONTEND"
}

return defaultFrontend, from
}

func (r *Root) Environment() *env_core.Environment {
return r.env
}
Expand Down

0 comments on commit 671d1aa

Please # to comment.