Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: deprecate --host, add --external-host #66

Merged
merged 4 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions internal/cmd/local/local_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const (
envDockerEmail = "ABCTL_LOCAL_INSTALL_DOCKER_EMAIL"
)

// defaultHost is the default hostname where the installed Airbyte instance will be accessible.
const defaultHost = "localhost"

func NewCmdInstall(provider k8s.Provider) *cobra.Command {
spinner := &pterm.DefaultSpinner

Expand All @@ -39,14 +42,17 @@ func NewCmdInstall(provider k8s.Provider) *cobra.Command {
flagChartVersion string
flagMigrate bool
flagPort int
flagHost string

flagDockerServer string
flagDockerUser string
flagDockerPass string
flagDockerEmail string

flagNoBrowser bool
flagNoBrowser bool
flagExternalHost string

// deprecated
flagHost string
)

cmd := &cobra.Command{
Expand All @@ -66,8 +72,15 @@ func NewCmdInstall(provider k8s.Provider) *cobra.Command {
telClient.Attr("docker_arch", dockerVersion.Arch)
telClient.Attr("docker_platform", dockerVersion.Platform)

if flagHost != defaultHost {
pterm.Warning.Println("The --host flag has been deprecated. Use --external-host instead.")
if flagExternalHost == defaultHost {
flagExternalHost = flagHost
}
}

spinner.UpdateText(fmt.Sprintf("Checking if port %d is available", flagPort))
if err := portAvailable(cmd.Context(), flagHost, flagPort); err != nil {
if err := portAvailable(cmd.Context(), flagExternalHost, flagPort); err != nil {
return fmt.Errorf("port %d is not available: %w", flagPort, err)
}
return nil
Expand Down Expand Up @@ -141,7 +154,7 @@ func NewCmdInstall(provider k8s.Provider) *cobra.Command {
Secrets: flagChartSecrets,
Migrate: flagMigrate,
Docker: dockerClient,
Host: flagHost,
Host: flagExternalHost,

DockerServer: flagDockerServer,
DockerUser: flagDockerUser,
Expand Down Expand Up @@ -178,7 +191,9 @@ func NewCmdInstall(provider k8s.Provider) *cobra.Command {
cmd.Flags().StringVarP(&flagBasicAuthUser, "username", "u", "airbyte", "basic auth username, can also be specified via "+envBasicAuthUser)
cmd.Flags().StringVarP(&flagBasicAuthPass, "password", "p", "password", "basic auth password, can also be specified via "+envBasicAuthPass)
cmd.Flags().IntVar(&flagPort, "port", local.Port, "ingress http port")
cmd.Flags().StringVar(&flagHost, "host", "localhost", "ingress http host")
cmd.Flags().StringVar(&flagExternalHost, "external-host", defaultHost, "ingress http host")
// host has been deprecated
cmd.Flags().StringVar(&flagHost, "host", defaultHost, "deprecated, use --external-host instead")

cmd.Flags().StringVar(&flagChartVersion, "chart-version", "latest", "specify the Airbyte helm chart version to install")
cmd.Flags().StringVar(&flagChartValuesFile, "values", "", "the Airbyte helm chart values file to load")
Expand Down