diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 6fa8a1680..96cfb32f0 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -318,6 +318,7 @@ function setupEnvironment { if [[ "${ZITI_CTRL_NAME-}" == "" ]]; then export ZITI_CTRL_NAME="${ZITI_NETWORK}"; else echo "ZITI_CTRL_NAME overridden: ${ZITI_CTRL_NAME}"; fi if [[ "${ZITI_CTRL_EDGE_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_PORT="1280"; else echo "ZITI_CTRL_EDGE_ADVERTISED_PORT overridden: ${ZITI_CTRL_EDGE_ADVERTISED_PORT}"; fi if [[ "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_ADDRESS="${ZITI_NETWORK-}"; else echo "ZITI_CTRL_EDGE_ADVERTISED_ADDRESS overridden: ${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}"; fi + if [[ "${ZITI_CTRL_BIND_ADDRESS-}" != "" ]]; then echo "ZITI_CTRL_BIND_ADDRESS overridden: ${ZITI_CTRL_BIND_ADDRESS}"; fi if [[ "${ZITI_CTRL_ADVERTISED_ADDRESS-}" == "" ]]; then export ZITI_CTRL_ADVERTISED_ADDRESS="${ZITI_NETWORK-}"; else echo "ZITI_CTRL_ADVERTISED_ADDRESS overridden: ${ZITI_CTRL_ADVERTISED_ADDRESS}"; fi if [[ "${ZITI_CTRL_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_ADVERTISED_PORT="6262"; else echo "ZITI_CTRL_ADVERTISED_PORT overridden: ${ZITI_CTRL_ADVERTISED_PORT}"; fi if [[ "${ZITI_PKI_CTRL_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_ROOTCA_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_ROOTCA_NAME}"; fi diff --git a/ziti/cmd/create_config.go b/ziti/cmd/create_config.go index 44666730b..f84e1353b 100644 --- a/ziti/cmd/create_config.go +++ b/ziti/cmd/create_config.go @@ -225,20 +225,15 @@ func (data *ConfigTemplateValues) populateConfigValues() { handleVariableError(err, constants.ZitiHomeVarName) // Get Ziti Controller Advertised Address - zitiCtrlAdvertisedAddress, err := cmdHelper.GetCtrlAdvertisedAddress() - handleVariableError(err, constants.CtrlAdvertisedAddressVarName) + zitiCtrlAdvertisedAddress := cmdHelper.GetCtrlAdvertisedAddress() // Get Ziti Controller ctrl:listener address and port - ctrlBindAddress, err := cmdHelper.GetCtrlBindAddress() - handleVariableError(err, constants.CtrlBindAddressVarName) - ctrlAdvertisedPort, err := cmdHelper.GetCtrlAdvertisedPort() - handleVariableError(err, constants.CtrlAdvertisedPortVarName) + ctrlBindAddress := cmdHelper.GetCtrlBindAddress() + ctrlAdvertisedPort := cmdHelper.GetCtrlAdvertisedPort() // Get Ziti Controller edge:api address and port - ctrlEdgeApiAddress, err := cmdHelper.GetCtrlEdgeApiAddress() - handleVariableError(err, constants.CtrlEdgeApiAddressVarName) - ctrlEdgeApiPort, err := cmdHelper.GetCtrlEdgeApiPort() - handleVariableError(err, constants.CtrlEdgeApiPortVarName) + ctrlEdgeApiAddress := cmdHelper.GetCtrlEdgeAdvertisedAddress() + ctrlEdgeApiPort := cmdHelper.GetCtrlEdgeAdvertisedPort() // Get Ziti Controller Identity edge:enrollment duration ctrlEdgeIdentityEnrollmentDuration, err := cmdHelper.GetCtrlEdgeIdentityEnrollmentDuration() @@ -249,22 +244,17 @@ func (data *ConfigTemplateValues) populateConfigValues() { handleVariableError(err, constants.CtrlEdgeRouterEnrollmentDurationVarName) // Get Ziti Controller web:bindPoints interface address and port - ctrlEdgeInterfaceAddress, err := cmdHelper.GetCtrlEdgeInterfaceAddress() - handleVariableError(err, constants.CtrlEdgeInterfaceAddressVarName) - ctrlEdgeInterfacePort, err := cmdHelper.GetCtrlEdgeInterfacePort() - handleVariableError(err, constants.CtrlEdgeInterfacePortVarName) + ctrlEdgeInterfaceAddress := cmdHelper.GetCtrlEdgeBindAddress() + ctrlEdgeInterfacePort := cmdHelper.GetCtrlEdgeAdvertisedPort() // Get Ziti Controller web:bindPoints address address and port - ctrlEdgeAdvertisedAddress, err := cmdHelper.GetCtrlEdgeAdvertisedAddress() - handleVariableError(err, constants.CtrlEdgeAdvertisedAddressVarName) - ctrlEdgeAdvertisedPort, err := cmdHelper.GetCtrlEdgeAdvertisedPort() - handleVariableError(err, constants.CtrlEdgeAdvertisedPortVarName) + ctrlEdgeAdvertisedAddress := cmdHelper.GetCtrlEdgeAdvertisedAddress() + ctrlEdgeAdvertisedPort := cmdHelper.GetCtrlEdgeAdvertisedPort() // Get Ziti Edge Router Port - zitiEdgeRouterPort, err := cmdHelper.GetZitiEdgeRouterPort() - handleVariableError(err, constants.ZitiEdgeRouterPortVarName) + zitiEdgeRouterPort := cmdHelper.GetZitiEdgeRouterPort() - zitiEdgeRouterListenerBindPort, err := cmdHelper.GetZitiEdgeRouterListenerBindPort() + zitiEdgeRouterListenerBindPort := cmdHelper.GetZitiEdgeRouterListenerBindPort() handleVariableError(err, constants.ZitiEdgeRouterListenerBindPortVarName) data.ZitiHome = zitiHome diff --git a/ziti/cmd/create_config_controller_test.go b/ziti/cmd/create_config_controller_test.go index a20974ae2..5f4423b3a 100644 --- a/ziti/cmd/create_config_controller_test.go +++ b/ziti/cmd/create_config_controller_test.go @@ -3,6 +3,7 @@ package cmd import ( "fmt" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/constants" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" "os" @@ -441,9 +442,9 @@ func TestCtrlConfigDefaultsWhenUnset(t *testing.T) { func TestCtrlConfigDefaultsWhenBlank(t *testing.T) { keys := map[string]string{ - "ZITI_PKI_CTRL_CERT": "", - "ZITI_CTRL_EDGE_ADVERTISED_ADDRESS": "", - "ZITI_HOME": "", + constants.PkiCtrlCertVarName: "", + constants.CtrlEdgeAdvertisedAddressVarName: "", + constants.ZitiHomeVarName: "", } // run the config ctrlConfig := execCreateConfigControllerCommand(nil, keys) @@ -645,10 +646,10 @@ func TestZitiCtrlIdentitySection(t *testing.T) { keyPath := "/var/test/custom/path/file.key" caPath := "/var/test/custom/path/file.pem" keys := map[string]string{ - "ZITI_PKI_CTRL_CERT": certPath, - "ZITI_PKI_CTRL_SERVER_CERT": serverCertPath, - "ZITI_PKI_CTRL_KEY": keyPath, - "ZITI_PKI_CTRL_CA": caPath, + constants.PkiCtrlCertVarName: certPath, + constants.PkiCtrlServerCertVarName: serverCertPath, + constants.PkiCtrlKeyVarName: keyPath, + constants.PkiCtrlCAVarName: caPath, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) @@ -666,7 +667,7 @@ func TestZitiCtrlIdentitySection(t *testing.T) { func TestCtrlBindAddress(t *testing.T) { customValue := "123.456.7.8" keys := map[string]string{ - "ZITI_CTRL_BIND_ADDRESS": customValue, + constants.CtrlBindAddressVarName: customValue, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) @@ -676,9 +677,9 @@ func TestCtrlBindAddress(t *testing.T) { } func TestCtrlAdvertisedPort(t *testing.T) { - customValue := "9999" + customValue := "9996" keys := map[string]string{ - "ZITI_CTRL_ADVERTISED_PORT": customValue, + constants.CtrlAdvertisedPortVarName: customValue, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) @@ -690,7 +691,7 @@ func TestCtrlAdvertisedPort(t *testing.T) { func TestCtrlEdgeAPIAddress(t *testing.T) { customValue := "123.456.7.8" keys := map[string]string{ - "ZITI_CTRL_EDGE_API_ADDRESS": customValue, + constants.CtrlEdgeAdvertisedAddressVarName: customValue, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) @@ -700,9 +701,9 @@ func TestCtrlEdgeAPIAddress(t *testing.T) { } func TestCtrlEdgeAPIPort(t *testing.T) { - customValue := "9999" + customValue := "9995" keys := map[string]string{ - "ZITI_CTRL_EDGE_API_PORT": customValue, + constants.CtrlEdgeAdvertisedPortVarName: customValue, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) @@ -715,8 +716,8 @@ func TestCtrlEdgeAPIEnrollmentSignerCert(t *testing.T) { certPath := "/var/test/custom/path/file.cert" keyPath := "/var/test/custom/path/file.key" keys := map[string]string{ - "ZITI_PKI_SIGNER_CERT": certPath, - "ZITI_PKI_SIGNER_KEY": keyPath, + constants.PkiSignerCertVarName: certPath, + constants.PkiSignerKeyVarName: keyPath, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) @@ -732,7 +733,7 @@ func TestEdgeIdentityEnrollmentDurationEnvVar(t *testing.T) { customValue := "5" expectedValue := customValue + "m" // Env Var int is converted to minutes format keys := map[string]string{ - "ZITI_EDGE_IDENTITY_ENROLLMENT_DURATION": customValue, + constants.CtrlEdgeIdentityEnrollmentDurationVarName: customValue, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) @@ -746,7 +747,7 @@ func TestEdgeIdentityEnrollmentDurationCLITakesPriority(t *testing.T) { cliValue := "10m" // Setting a CLI custom duration which is also not the default value expectedConfigValue := cliValue keys := map[string]string{ - "ZITI_EDGE_IDENTITY_ENROLLMENT_DURATION": envVarValue, + constants.CtrlEdgeIdentityEnrollmentDurationVarName: envVarValue, } args := []string{"--identityEnrollmentDuration", cliValue} @@ -780,7 +781,7 @@ func TestEdgeRouterEnrollmentDurationEnvVar(t *testing.T) { customValue := "5" expectedValue := customValue + "m" // Env Var int is converted to minutes format keys := map[string]string{ - "ZITI_EDGE_ROUTER_ENROLLMENT_DURATION": customValue, + constants.CtrlEdgeRouterEnrollmentDurationVarName: customValue, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) @@ -794,7 +795,7 @@ func TestEdgeRouterEnrollmentDurationCLITakesPriority(t *testing.T) { cliValue := "10m" // Setting a CLI custom duration which is also not the default value expectedConfigValue := cliValue keys := map[string]string{ - "ZITI_EDGE_ROUTER_ENROLLMENT_DURATION": envVarValue, + constants.CtrlEdgeRouterEnrollmentDurationVarName: envVarValue, } args := []string{"--routerEnrollmentDuration", cliValue} @@ -846,8 +847,8 @@ func TestEdgeRouterAndIdentityEnrollmentDurationTogetherEnvVar(t *testing.T) { // Create and run the CLI command keys := map[string]string{ - "ZITI_EDGE_IDENTITY_ENROLLMENT_DURATION": envVarIdentityDurationValue, - "ZITI_EDGE_ROUTER_ENROLLMENT_DURATION": envVarRouterDurationValue, + constants.CtrlEdgeIdentityEnrollmentDurationVarName: envVarIdentityDurationValue, + constants.CtrlEdgeRouterEnrollmentDurationVarName: envVarRouterDurationValue, } configStruct := execCreateConfigControllerCommand(nil, keys) @@ -857,33 +858,24 @@ func TestEdgeRouterAndIdentityEnrollmentDurationTogetherEnvVar(t *testing.T) { } func TestCtrlEdgeInterfaceAddress(t *testing.T) { - customValue := "123.456.7.8" + addy := "custom.domain.name" + port := "9998" keys := map[string]string{ - "ZITI_CTRL_EDGE_INTERFACE_ADDRESS": customValue, + constants.CtrlEdgeBindAddressVarName: addy, + constants.CtrlEdgeAdvertisedPortVarName: port, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) - assert.Equal(t, customValue, data.Controller.Web.BindPoints.InterfaceAddress) - assert.Equal(t, customValue, strings.Split(ctrlConfig.Web[0].BindPoints[0].BpInterface, ":")[0]) -} - -func TestCtrlEdgeInterfacePort(t *testing.T) { - customValue := "9999" - keys := map[string]string{ - "ZITI_CTRL_EDGE_INTERFACE_PORT": customValue, - } - - ctrlConfig := execCreateConfigControllerCommand(nil, keys) - - assert.Equal(t, customValue, data.Controller.Web.BindPoints.InterfacePort) - assert.Equal(t, customValue, strings.Split(ctrlConfig.Web[0].BindPoints[0].BpInterface, ":")[1]) + assert.Equal(t, addy, data.Controller.Web.BindPoints.InterfaceAddress) + assert.Equal(t, addy, strings.Split(ctrlConfig.Web[0].BindPoints[0].BpInterface, ":")[0]) + assert.Equal(t, port, strings.Split(ctrlConfig.Web[0].BindPoints[0].BpInterface, ":")[1]) } func TestCtrlEdgeAdvertisedAddress(t *testing.T) { customValue := "123.456.7.8" keys := map[string]string{ - "ZITI_CTRL_EDGE_ADVERTISED_ADDRESS": customValue, + constants.CtrlEdgeAdvertisedAddressVarName: customValue, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) @@ -893,9 +885,9 @@ func TestCtrlEdgeAdvertisedAddress(t *testing.T) { } func TestCtrlEdgeAdvertisedPort(t *testing.T) { - customValue := "9999" + customValue := "9997" keys := map[string]string{ - "ZITI_CTRL_EDGE_ADVERTISED_PORT": customValue, + constants.CtrlEdgeAdvertisedPortVarName: customValue, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) @@ -910,10 +902,10 @@ func TestCtrlEdgeIdentitySection(t *testing.T) { serverCertPath := "/var/test/custom/path/file.chain.pem" certPath := "/var/test/custom/path/file.cert" keys := map[string]string{ - "ZITI_PKI_CTRL_CA": caPath, - "ZITI_PKI_CTRL_KEY": keyPath, - "ZITI_PKI_CTRL_SERVER_CERT": serverCertPath, - "ZITI_PKI_CTRL_CERT": certPath, + constants.PkiCtrlCAVarName: caPath, + constants.PkiCtrlKeyVarName: keyPath, + constants.PkiCtrlServerCertVarName: serverCertPath, + constants.PkiCtrlCertVarName: certPath, } ctrlConfig := execCreateConfigControllerCommand(nil, keys) diff --git a/ziti/cmd/create_config_environment.go b/ziti/cmd/create_config_environment.go index 7236214d9..0674472b7 100644 --- a/ziti/cmd/create_config_environment.go +++ b/ziti/cmd/create_config_environment.go @@ -101,14 +101,12 @@ func NewCmdCreateConfigEnvironment() *cobra.Command { {constants.CtrlBindAddressVarName, constants.CtrlBindAddressVarDescription, data.Controller.Ctrl.BindAddress}, {constants.CtrlAdvertisedAddressVarName, constants.CtrlAdvertisedAddressVarDescription, data.Controller.Ctrl.AdvertisedAddress}, {constants.CtrlAdvertisedPortVarName, constants.CtrlAdvertisedPortVarDescription, data.Controller.Ctrl.AdvertisedPort}, - {constants.CtrlEdgeApiAddressVarName, constants.CtrlEdgeApiAddressVarDescription, data.Controller.EdgeApi.Address}, - {constants.CtrlEdgeApiPortVarName, constants.CtrlEdgeApiPortVarDescription, data.Controller.EdgeApi.Port}, + {constants.CtrlEdgeAdvertisedAddressVarName, constants.CtrlEdgeAdvertisedAddressVarDescription, data.Controller.EdgeApi.Address}, + {constants.CtrlEdgeAdvertisedPortVarName, constants.CtrlEdgeAdvertisedPortVarDescription, data.Controller.EdgeApi.Port}, {constants.PkiSignerCertVarName, constants.PkiSignerCertVarDescription, data.Controller.EdgeEnrollment.SigningCert}, {constants.PkiSignerKeyVarName, constants.PkiSignerKeyVarDescription, data.Controller.EdgeEnrollment.SigningCertKey}, {constants.CtrlEdgeIdentityEnrollmentDurationVarName, constants.CtrlEdgeIdentityEnrollmentDurationVarDescription, strconv.FormatInt(int64(data.Controller.EdgeEnrollment.EdgeIdentityDuration), 10)}, {constants.CtrlEdgeRouterEnrollmentDurationVarName, constants.CtrlEdgeRouterEnrollmentDurationVarDescription, strconv.FormatInt(int64(data.Controller.EdgeEnrollment.EdgeRouterDuration), 10)}, - {constants.CtrlEdgeInterfaceAddressVarName, constants.CtrlEdgeInterfaceAddressVarDescription, data.Controller.Web.BindPoints.InterfaceAddress}, - {constants.CtrlEdgeInterfacePortVarName, constants.CtrlEdgeInterfacePortVarDescription, data.Controller.Web.BindPoints.InterfacePort}, {constants.CtrlEdgeAdvertisedAddressVarName, constants.CtrlEdgeAdvertisedAddressVarDescription, data.Controller.Web.BindPoints.AddressAddress}, {constants.CtrlEdgeAdvertisedPortVarName, constants.CtrlEdgeAdvertisedPortVarDescription, data.Controller.Web.BindPoints.AddressPort}, {constants.CtrlPkiEdgeCertVarName, constants.CtrlPkiEdgeCertVarDescription, data.Controller.Web.Identity.Cert}, @@ -159,76 +157,45 @@ func NewCmdCreateConfigEnvironment() *cobra.Command { }, } - createConfigLong := fmt.Sprintf("Creates a config file for specified Ziti component using environment variables which have default values but can be manually set to override the config output.\n\n"+ - "The following environment variables can be set to override config values (current value is displayed):\n"+ - "%-36s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s\n"+ - "%-40s %-50s %s", - constants.ZitiHomeVarName, constants.ZitiHomeVarDescription, data.ZitiHome, - constants.PkiCtrlCertVarName, constants.PkiCtrlCertVarDescription, data.Controller.Identity.Cert, - constants.PkiCtrlServerCertVarName, constants.PkiCtrlServerCertVarDescription, data.Controller.Identity.ServerCert, - constants.PkiCtrlKeyVarName, constants.PkiCtrlKeyVarDescription, data.Controller.Identity.Key, - constants.PkiCtrlCAVarName, constants.PkiCtrlCAVarDescription, data.Controller.Identity.Ca, - constants.CtrlBindAddressVarName, constants.CtrlBindAddressVarDescription, data.Controller.Ctrl.BindAddress, - constants.CtrlAdvertisedAddressVarName, constants.CtrlAdvertisedAddressVarDescription, data.Controller.Ctrl.AdvertisedAddress, - constants.CtrlAdvertisedPortVarName, constants.CtrlAdvertisedPortVarDescription, data.Controller.Ctrl.AdvertisedPort, - constants.CtrlEdgeApiAddressVarName, constants.CtrlEdgeApiAddressVarDescription, data.Controller.EdgeApi.Address, - constants.CtrlEdgeApiPortVarName, constants.CtrlEdgeApiPortVarDescription, data.Controller.EdgeApi.Port, - constants.PkiSignerCertVarName, constants.PkiSignerCertVarDescription, data.Controller.EdgeEnrollment.SigningCert, - constants.PkiSignerKeyVarName, constants.PkiSignerKeyVarDescription, data.Controller.EdgeEnrollment.SigningCertKey, - constants.CtrlEdgeIdentityEnrollmentDurationVarName, constants.CtrlEdgeIdentityEnrollmentDurationVarDescription, strconv.FormatInt(int64(data.Controller.EdgeEnrollment.EdgeIdentityDuration), 10), - constants.CtrlEdgeRouterEnrollmentDurationVarName, constants.CtrlEdgeRouterEnrollmentDurationVarDescription, strconv.FormatInt(int64(data.Controller.EdgeEnrollment.EdgeRouterDuration), 10), - constants.CtrlEdgeInterfaceAddressVarName, constants.CtrlEdgeInterfaceAddressVarDescription, data.Controller.Web.BindPoints.InterfaceAddress, - constants.CtrlEdgeInterfacePortVarName, constants.CtrlEdgeInterfacePortVarDescription, data.Controller.Web.BindPoints.InterfacePort, - constants.CtrlEdgeAdvertisedAddressVarName, constants.CtrlEdgeAdvertisedAddressVarDescription, data.Controller.Web.BindPoints.AddressAddress, - constants.CtrlEdgeAdvertisedPortVarName, constants.CtrlEdgeAdvertisedPortVarDescription, data.Controller.Web.BindPoints.AddressPort, - constants.CtrlPkiEdgeCertVarName, constants.CtrlPkiEdgeCertVarDescription, data.Controller.Web.Identity.Cert, - constants.CtrlPkiEdgeServerCertVarName, constants.CtrlPkiEdgeServerCertVarDescription, data.Controller.Web.Identity.ServerCert, - constants.CtrlPkiEdgeKeyVarName, constants.CtrlPkiEdgeKeyVarDescription, data.Controller.Web.Identity.Key, - constants.CtrlPkiEdgeCAVarName, constants.CtrlPkiEdgeCAVarDescription, data.Controller.Web.Identity.Ca, - constants.ZitiEdgeRouterNameVarName, constants.ZitiEdgeRouterNameVarDescription, data.Router.Name, - constants.ZitiEdgeRouterPortVarName, constants.ZitiEdgeRouterPortVarDescription, data.Router.Edge.Port, - constants.ZitiEdgeRouterListenerBindPortVarName, constants.ZitiEdgeRouterListenerBindPortVarDescription, data.Router.Edge.ListenerBindPort, - constants.ZitiRouterIdentityCertVarName, constants.ZitiRouterIdentityCertVarDescription, data.Router.IdentityCert, - constants.ZitiRouterIdentityServerCertVarName, constants.ZitiRouterIdentityServerCertVarDescription, data.Router.IdentityServerCert, - constants.ZitiRouterIdentityKeyVarName, constants.ZitiRouterIdentityKeyVarDescription, data.Router.IdentityKey, - constants.ZitiRouterIdentityCAVarName, constants.ZitiRouterIdentityCAVarDescription, data.Router.IdentityCA, - constants.ZitiEdgeRouterIPOverrideVarName, constants.ZitiEdgeRouterIPOverrideVarDescription, data.Router.Edge.IPOverride, - constants.ZitiEdgeRouterAdvertisedHostVarName, constants.ZitiEdgeRouterAdvertisedHostVarDescription, data.Router.Edge.AdvertisedHost, - constants.CtrlEdgeIdentityEnrollmentDurationVarName, constants.CtrlEdgeIdentityEnrollmentDurationVarDescription, fmt.Sprintf("%.0f", data.Controller.EdgeEnrollment.EdgeIdentityDuration.Minutes()), - constants.CtrlEdgeRouterEnrollmentDurationVarName, constants.CtrlEdgeRouterEnrollmentDurationVarDescription, fmt.Sprintf("%.0f", data.Controller.EdgeEnrollment.EdgeRouterDuration.Minutes())) + var sb strings.Builder - cmd.Long = createConfigLong + sb.WriteString("Creates a config file for specified component. Instead of numerous flags to be set " + + "environment variables are used. All settings have default values but can be manually set to override " + + "the config output.\n\nThe following environment variables can be set to override config values " + + "(current value is displayed):\n") + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.ZitiHomeVarName, constants.ZitiHomeVarDescription, data.ZitiHome)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.PkiCtrlCertVarName, constants.PkiCtrlCertVarDescription, data.Controller.Identity.Cert)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.PkiCtrlServerCertVarName, constants.PkiCtrlServerCertVarDescription, data.Controller.Identity.ServerCert)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.PkiCtrlKeyVarName, constants.PkiCtrlKeyVarDescription, data.Controller.Identity.Key)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.PkiCtrlCAVarName, constants.PkiCtrlCAVarDescription, data.Controller.Identity.Ca)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlBindAddressVarName, constants.CtrlBindAddressVarDescription, data.Controller.Ctrl.BindAddress)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlAdvertisedAddressVarName, constants.CtrlAdvertisedAddressVarDescription, data.Controller.Ctrl.AdvertisedAddress)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlAdvertisedPortVarName, constants.CtrlAdvertisedPortVarDescription, data.Controller.Ctrl.AdvertisedPort)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlEdgeBindAddressVarName, constants.CtrlEdgeBindAddressVarDescription, data.Controller.EdgeApi.Address)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlEdgeAdvertisedPortVarName, constants.CtrlEdgeAdvertisedPortVarDescription, data.Controller.EdgeApi.Port)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.PkiSignerCertVarName, constants.PkiSignerCertVarDescription, data.Controller.EdgeEnrollment.SigningCert)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.PkiSignerKeyVarName, constants.PkiSignerKeyVarDescription, data.Controller.EdgeEnrollment.SigningCertKey)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlEdgeIdentityEnrollmentDurationVarName, constants.CtrlEdgeIdentityEnrollmentDurationVarDescription, strconv.FormatInt(int64(data.Controller.EdgeEnrollment.EdgeIdentityDuration), 10))) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlEdgeRouterEnrollmentDurationVarName, constants.CtrlEdgeRouterEnrollmentDurationVarDescription, strconv.FormatInt(int64(data.Controller.EdgeEnrollment.EdgeRouterDuration), 10))) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlEdgeAdvertisedAddressVarName, constants.CtrlEdgeAdvertisedAddressVarDescription, data.Controller.Web.BindPoints.AddressAddress)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlEdgeAdvertisedPortVarName, constants.CtrlEdgeAdvertisedPortVarDescription, data.Controller.Web.BindPoints.AddressPort)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlPkiEdgeCertVarName, constants.CtrlPkiEdgeCertVarDescription, data.Controller.Web.Identity.Cert)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlPkiEdgeServerCertVarName, constants.CtrlPkiEdgeServerCertVarDescription, data.Controller.Web.Identity.ServerCert)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlPkiEdgeKeyVarName, constants.CtrlPkiEdgeKeyVarDescription, data.Controller.Web.Identity.Key)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlPkiEdgeCAVarName, constants.CtrlPkiEdgeCAVarDescription, data.Controller.Web.Identity.Ca)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.ZitiEdgeRouterNameVarName, constants.ZitiEdgeRouterNameVarDescription, data.Router.Name)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.ZitiEdgeRouterPortVarName, constants.ZitiEdgeRouterPortVarDescription, data.Router.Edge.Port)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.ZitiEdgeRouterListenerBindPortVarName, constants.ZitiEdgeRouterListenerBindPortVarDescription, data.Router.Edge.ListenerBindPort)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.ZitiRouterIdentityCertVarName, constants.ZitiRouterIdentityCertVarDescription, data.Router.IdentityCert)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.ZitiRouterIdentityServerCertVarName, constants.ZitiRouterIdentityServerCertVarDescription, data.Router.IdentityServerCert)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.ZitiRouterIdentityKeyVarName, constants.ZitiRouterIdentityKeyVarDescription, data.Router.IdentityKey)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.ZitiRouterIdentityCAVarName, constants.ZitiRouterIdentityCAVarDescription, data.Router.IdentityCA)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.ZitiEdgeRouterIPOverrideVarName, constants.ZitiEdgeRouterIPOverrideVarDescription, data.Router.Edge.IPOverride)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.ZitiEdgeRouterAdvertisedHostVarName, constants.ZitiEdgeRouterAdvertisedHostVarDescription, data.Router.Edge.AdvertisedHost)) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlEdgeIdentityEnrollmentDurationVarName, constants.CtrlEdgeIdentityEnrollmentDurationVarDescription, fmt.Sprintf("%.0f", data.Controller.EdgeEnrollment.EdgeIdentityDuration.Minutes()))) + sb.WriteString(fmt.Sprintf("%-40s %-50s %s\n", constants.CtrlEdgeRouterEnrollmentDurationVarName, constants.CtrlEdgeRouterEnrollmentDurationVarDescription, fmt.Sprintf("%.0f", data.Controller.EdgeEnrollment.EdgeRouterDuration.Minutes()))) + + cmd.Long = sb.String() environmentOptions.addCreateFlags(cmd) diff --git a/ziti/cmd/create_config_test.go b/ziti/cmd/create_config_test.go index 5b3f24763..609754ffb 100644 --- a/ziti/cmd/create_config_test.go +++ b/ziti/cmd/create_config_test.go @@ -16,7 +16,6 @@ import ( // as they are expecting these hard-coded values. In which case, we update the hard-coded values and check any docs. const ( testDefaultCtrlEdgeAdvertisedPort = "1280" - testDefaultCtrlAdvertisedAddress = "0.0.0.0" testDefaultCtrlBindAddress = "0.0.0.0" testDefaultCtrlAdvertisedPort = "6262" testDefaultBoltCheckInterval = "30s" @@ -49,8 +48,6 @@ func getZitiEnvironmentVariables() []string { "ZITI_CTRL_EDGE_API_PORT", "ZITI_PKI_SIGNER_CERT", "ZITI_PKI_SIGNER_KEY", - "ZITI_CTRL_EDGE_INTERFACE_ADDRESS", - "ZITI_CTRL_EDGE_INTERFACE_PORT", "ZITI_CTRL_EDGE_ADVERTISED_ADDRESS", "ZITI_CTRL_EDGE_ADVERTISED_PORT", "ZITI_PKI_EDGE_CA", diff --git a/ziti/cmd/helpers/env_helpers.go b/ziti/cmd/helpers/env_helpers.go index b79103e82..3d40eab95 100644 --- a/ziti/cmd/helpers/env_helpers.go +++ b/ziti/cmd/helpers/env_helpers.go @@ -81,104 +81,49 @@ func HostnameOrNetworkName() string { return val } -func GetCtrlAdvertisedAddress() (string, error) { - return getValueOrSetAndGetDefault(constants.CtrlAdvertisedAddressVarName, constants.DefaultCtrlAdvertisedAddress) -} - -func GetCtrlBindAddress() (string, error) { - return getValueOrSetAndGetDefault(constants.CtrlBindAddressVarName, constants.DefaultCtrlBindAddress) -} - -func GetCtrlAdvertisedPort() (string, error) { - return getValueOrSetAndGetDefault(constants.CtrlAdvertisedPortVarName, constants.DefaultCtrlAdvertisedPort) -} - -func GetCtrlEdgeApiAddress() (string, error) { - // Get the controller's edge advertised hostname to use as the default - defaultAddress, err := GetCtrlEdgeAdvertisedAddress() - if err != nil { - err := errors.Wrap(err, "Unable to get "+constants.CtrlEdgeAdvertisedAddressVarName) - if err != nil { - return "", err - } +func defaultValue(val string) func() string { + return func() string { + return val } - - return getValueOrSetAndGetDefault(constants.CtrlEdgeApiAddressVarName, defaultAddress) } - -func GetCtrlEdgeApiPort() (string, error) { - // Get the controller's edge advertised port to use as the default - defaultPort, err := GetCtrlEdgeAdvertisedPort() - if err != nil { - err := errors.Wrap(err, "Unable to get "+constants.CtrlEdgeAdvertisedPortVarName) - if err != nil { - return "", err - } +func defaultIntValue(val int64) func() string { + return func() string { + return strconv.FormatInt(val, 10) } - - return getValueOrSetAndGetDefault(constants.CtrlEdgeApiPortVarName, defaultPort) } -func GetCtrlEdgeInterfaceAddress() (string, error) { - // Get the controller's listener hostname to use as the default - defaultHostname, err := GetCtrlAdvertisedAddress() - if err != nil { - err := errors.Wrap(err, "Unable to get "+constants.CtrlAdvertisedAddressVarName) - if err != nil { - return "", err - } - } - - return getValueOrSetAndGetDefault(constants.CtrlEdgeInterfaceAddressVarName, defaultHostname) +func GetCtrlBindAddress() string { + return getFromEnv(constants.CtrlBindAddressVarName, defaultValue(constants.DefaultCtrlBindAddress)) } -func GetCtrlEdgeInterfacePort() (string, error) { - // Get the controller's edge advertised port to use as the default - defaultPort, err := GetCtrlEdgeAdvertisedPort() - if err != nil { - err := errors.Wrap(err, "Unable to get "+constants.CtrlEdgeAdvertisedPortVarName) - if err != nil { - return "", err - } - } - - return getValueOrSetAndGetDefault(constants.CtrlEdgeInterfacePortVarName, defaultPort) +func GetCtrlAdvertisedAddress() string { + return getFromEnv(constants.CtrlAdvertisedAddressVarName, HostnameOrNetworkName) } -func GetCtrlEdgeAdvertisedAddress() (string, error) { - - // Use hostname if edge advertised address not set - hostname, err := os.Hostname() - if err != nil { - err := errors.Wrap(err, "Unable to get hostname") - if err != nil { - return "", err - } - } - - return getValueOrSetAndGetDefault(constants.CtrlEdgeAdvertisedAddressVarName, hostname) +func GetCtrlAdvertisedPort() string { + return getFromEnv(constants.CtrlAdvertisedPortVarName, defaultValue(constants.DefaultCtrlAdvertisedPort)) } -func GetCtrlEdgeAdvertisedPort() (string, error) { - return getValueOrSetAndGetDefault(constants.CtrlEdgeAdvertisedPortVarName, constants.DefaultCtrlEdgeAdvertisedPort) +func GetCtrlEdgeBindAddress() string { + return getFromEnv(constants.CtrlEdgeBindAddressVarName, defaultValue(constants.DefaultCtrlEdgeBindAddress)) +} +func GetCtrlEdgeAdvertisedAddress() string { + return getFromEnv(constants.CtrlEdgeAdvertisedAddressVarName, HostnameOrNetworkName) +} +func GetCtrlEdgeAdvertisedPort() string { + return getFromEnv(constants.CtrlEdgeAdvertisedPortVarName, defaultValue(constants.DefaultCtrlEdgeAdvertisedPort)) } -func GetZitiEdgeRouterPort() (string, error) { - return getValueOrSetAndGetDefault(constants.ZitiEdgeRouterPortVarName, constants.DefaultZitiEdgeRouterPort) +func GetZitiEdgeRouterPort() string { + return getFromEnv(constants.ZitiEdgeRouterPortVarName, defaultValue(constants.DefaultZitiEdgeRouterPort)) } -func GetZitiEdgeRouterListenerBindPort() (string, error) { - return getValueOrSetAndGetDefault(constants.ZitiEdgeRouterListenerBindPortVarName, constants.DefaultZitiEdgeRouterListenerBindPort) +func GetZitiEdgeRouterListenerBindPort() string { + return getFromEnv(constants.ZitiEdgeRouterListenerBindPortVarName, defaultValue(constants.DefaultZitiEdgeRouterListenerBindPort)) } func GetCtrlEdgeIdentityEnrollmentDuration() (time.Duration, error) { - retVal, err := getValueOrSetAndGetDefault(constants.CtrlEdgeIdentityEnrollmentDurationVarName, strconv.FormatInt(int64(edge.DefaultEdgeEnrollmentDuration.Minutes()), 10)) - if err != nil { - err := errors.Wrap(err, "Unable to get "+constants.CtrlEdgeIdentityEnrollmentDurationVarDescription) - if err != nil { - return edge.DefaultEdgeEnrollmentDuration, err - } - } + retVal := getFromEnv(constants.CtrlEdgeIdentityEnrollmentDurationVarName, defaultIntValue(int64(edge.DefaultEdgeEnrollmentDuration.Minutes()))) retValInt, err := strconv.Atoi(retVal) if err != nil { err := errors.Wrap(err, "Unable to get "+constants.CtrlEdgeIdentityEnrollmentDurationVarDescription) @@ -191,13 +136,7 @@ func GetCtrlEdgeIdentityEnrollmentDuration() (time.Duration, error) { } func GetCtrlEdgeRouterEnrollmentDuration() (time.Duration, error) { - retVal, err := getValueOrSetAndGetDefault(constants.CtrlEdgeRouterEnrollmentDurationVarName, strconv.FormatInt(int64(edge.DefaultEdgeEnrollmentDuration.Minutes()), 10)) - if err != nil { - err := errors.Wrap(err, "Unable to get "+constants.CtrlEdgeRouterEnrollmentDurationVarDescription) - if err != nil { - return edge.DefaultEdgeEnrollmentDuration, err - } - } + retVal := getFromEnv(constants.CtrlEdgeRouterEnrollmentDurationVarName, defaultIntValue(int64(edge.DefaultEdgeEnrollmentDuration.Minutes()))) retValInt, err := strconv.Atoi(retVal) if err != nil { err := errors.Wrap(err, "Unable to get "+constants.CtrlEdgeRouterEnrollmentDurationVarDescription) @@ -206,25 +145,18 @@ func GetCtrlEdgeRouterEnrollmentDuration() (time.Duration, error) { } } - //fmt.Println("Router Duration: " + retVal + " - " + (time.Duration(retValInt) * time.Minute).String()) return time.Duration(retValInt) * time.Minute, nil } -func getValueOrSetAndGetDefault(envVarName string, defaultValue string) (string, error) { +type envVarNotFound func() string + +func getFromEnv(envVarName string, onNotFound envVarNotFound) string { // Get path from env variable retVal := os.Getenv(envVarName) if retVal != "" { - return retVal, nil + return retVal } - - err := os.Setenv(envVarName, defaultValue) - if err != nil { - return "", err - } - - retVal = os.Getenv(envVarName) - - return retVal, nil + return onNotFound() } // NormalizePath replaces windows \ with / which windows allows for diff --git a/ziti/cmd/helpers/helpers_test.go b/ziti/cmd/helpers/helpers_test.go index 9496af5e6..36f5405ca 100644 --- a/ziti/cmd/helpers/helpers_test.go +++ b/ziti/cmd/helpers/helpers_test.go @@ -9,6 +9,13 @@ import ( "time" ) +var hostname string + +func init() { + hn, _ := os.Hostname() + hostname = hn +} + func TestHomeDirHasNoWindowsSlashes(t *testing.T) { value := HomeDir() assert.Zero(t, strings.Count(value, "\\")) @@ -31,10 +38,6 @@ func TestGetZitiHomeWhenUnset(t *testing.T) { // Check that the value matches actualValue, _ := GetZitiHome() assert.Equal(t, expectedValue, actualValue) - - // The env variable should be populated with the expected value - envValue := os.Getenv(varName) - assert.Equal(t, expectedValue, envValue) } func TestGetZitiHomeWhenSet(t *testing.T) { @@ -69,15 +72,11 @@ func TestGetCtrlEdgeAdvertisedAddressWhenUnset(t *testing.T) { // Ensure the variable is unset _ = os.Unsetenv(varName) - expectedValue, _ := os.Hostname() + expectedValue := hostname // Check that the value matches - actualValue, _ := GetCtrlEdgeAdvertisedAddress() + actualValue := GetCtrlEdgeAdvertisedAddress() assert.Equal(t, expectedValue, actualValue) - - // The env variable should be populated with the expected value - envValue := os.Getenv(varName) - assert.Equal(t, expectedValue, envValue) } func TestGetCtrlEdgeAdvertisedAddressWhenSet(t *testing.T) { @@ -87,9 +86,9 @@ func TestGetCtrlEdgeAdvertisedAddressWhenSet(t *testing.T) { // Set the env variable _ = os.Setenv(varName, expectedValue) - + a := get // Check that the value matches - actualValue, _ := GetCtrlEdgeAdvertisedAddress() + actualValue := GetCtrlEdgeAdvertisedAddress() assert.Equal(t, expectedValue, actualValue) } @@ -102,12 +101,8 @@ func TestGetCtrlAdvertisedPortWhenUnset(t *testing.T) { expectedValue := "6262" // Check that the value matches - actualValue, _ := GetCtrlAdvertisedPort() + actualValue := GetCtrlAdvertisedPort() assert.Equal(t, expectedValue, actualValue) - - // The env variable should be populated with the expected value - envValue := os.Getenv(varName) - assert.Equal(t, expectedValue, envValue) } func TestGetCtrlAdvertisedPortWhenSet(t *testing.T) { @@ -119,7 +114,7 @@ func TestGetCtrlAdvertisedPortWhenSet(t *testing.T) { _ = os.Setenv(varName, expectedValue) // Check that the value matches - actualValue, _ := GetCtrlAdvertisedPort() + actualValue := GetCtrlAdvertisedPort() assert.Equal(t, expectedValue, actualValue) } @@ -129,15 +124,11 @@ func TestGetCtrlAdvertisedAddressWhenUnset(t *testing.T) { // Ensure the variable is unset _ = os.Unsetenv(varName) - expectedValue := "0.0.0.0" + expectedValue := hostname // Check that the value matches - actualValue, _ := GetCtrlAdvertisedAddress() + actualValue := GetCtrlAdvertisedAddress() assert.Equal(t, expectedValue, actualValue) - - // The env variable should be populated with the expected value - envValue := os.Getenv(varName) - assert.Equal(t, expectedValue, envValue) } func TestGetCtrlAdvertisedAddressWhenSet(t *testing.T) { @@ -149,7 +140,7 @@ func TestGetCtrlAdvertisedAddressWhenSet(t *testing.T) { _ = os.Setenv(varName, expectedValue) // Check that the value matches - actualValue, _ := GetCtrlAdvertisedAddress() + actualValue := GetCtrlAdvertisedAddress() assert.Equal(t, expectedValue, actualValue) } @@ -162,12 +153,8 @@ func TestGetEdgeRouterPortWhenUnset(t *testing.T) { expectedValue := "3022" // Check that the value matches - actualValue, _ := GetZitiEdgeRouterPort() + actualValue := GetZitiEdgeRouterPort() assert.Equal(t, expectedValue, actualValue) - - // The env variable should be populated with the expected value - envValue := os.Getenv(varName) - assert.Equal(t, expectedValue, envValue) } func TestGetEdgeRouterPortWhenSet(t *testing.T) { @@ -179,7 +166,7 @@ func TestGetEdgeRouterPortWhenSet(t *testing.T) { _ = os.Setenv(varName, expectedValue) // Check that the value matches - actualValue, _ := GetZitiEdgeRouterPort() + actualValue := GetZitiEdgeRouterPort() assert.Equal(t, expectedValue, actualValue) } @@ -192,7 +179,7 @@ func TestGetCtrlEdgeAdvertisedPortWhenNotSet(t *testing.T) { _ = os.Unsetenv(varName) // Check that the value matches - actualValue, _ := GetCtrlEdgeAdvertisedPort() + actualValue := GetCtrlEdgeAdvertisedPort() assert.Equal(t, expectedValue, actualValue) } @@ -205,7 +192,7 @@ func TestGetCtrlEdgeAdvertisedPortWhenSet(t *testing.T) { _ = os.Setenv(varName, expectedValue) // Check that the value matches - actualValue, _ := GetCtrlEdgeAdvertisedPort() + actualValue := GetCtrlEdgeAdvertisedPort() assert.Equal(t, expectedValue, actualValue) } diff --git a/ziti/constants/constants.go b/ziti/constants/constants.go index 12eda1fce..d12c98e7b 100644 --- a/ziti/constants/constants.go +++ b/ziti/constants/constants.go @@ -39,11 +39,13 @@ const ( DefaultZitiEdgeRouterListenerBindPort = "10080" DefaultGetSessionTimeout = 60 * time.Second - DefaultZitiEdgeRouterPort = "3022" + DefaultZitiEdgeRouterPort = "3022" + + DefaultCtrlBindAddress = "0.0.0.0" + DefaultCtrlAdvertisedPort = "6262" + + DefaultCtrlEdgeBindAddress = "0.0.0.0" DefaultCtrlEdgeAdvertisedPort = "1280" - DefaultCtrlAdvertisedAddress = "0.0.0.0" - DefaultCtrlBindAddress = "0.0.0.0" - DefaultCtrlAdvertisedPort = "6262" ) // Env Var Constants @@ -60,15 +62,17 @@ const ( PkiCtrlCAVarName = "ZITI_PKI_CTRL_CA" PkiCtrlCAVarDescription = "Path to Identity CA for Ziti Controller" CtrlBindAddressVarName = "ZITI_CTRL_BIND_ADDRESS" - CtrlBindAddressVarDescription = "The address on which the controller will listen for communication on the control plane." + CtrlBindAddressVarDescription = "The address on which the controller will listen on for control plane connections." CtrlAdvertisedAddressVarName = "ZITI_CTRL_ADVERTISED_ADDRESS" CtrlAdvertisedAddressVarDescription = "The address routers will use to connect to the Ziti Controller" CtrlAdvertisedPortVarName = "ZITI_CTRL_ADVERTISED_PORT" CtrlAdvertisedPortVarDescription = "The port routers will use to connect to the Ziti Controller" - CtrlEdgeApiAddressVarName = "ZITI_CTRL_EDGE_API_ADDRESS" - CtrlEdgeApiAddressVarDescription = "The address for the controller's API plane" - CtrlEdgeApiPortVarName = "ZITI_CTRL_EDGE_API_PORT" - CtrlEdgeApiPortVarDescription = "The port for the controller's API plane" + CtrlEdgeBindAddressVarName = "ZITI_CTRL_EDGE_BIND_ADDRESS" + CtrlEdgeBindAddressVarDescription = "The address on which the edge controller will listen on for API connections." + CtrlEdgeAdvertisedAddressVarName = "ZITI_CTRL_EDGE_ADVERTISED_ADDRESS" + CtrlEdgeAdvertisedAddressVarDescription = "The publicly addressable controller address value" + CtrlEdgeAdvertisedPortVarName = "ZITI_CTRL_EDGE_ADVERTISED_PORT" + CtrlEdgeAdvertisedPortVarDescription = "The publicly addressable controller port value" PkiSignerCertVarName = "ZITI_PKI_SIGNER_CERT" PkiSignerCertVarDescription = "Path to the Ziti Signing Cert" PkiSignerKeyVarName = "ZITI_PKI_SIGNER_KEY" @@ -77,14 +81,6 @@ const ( CtrlEdgeIdentityEnrollmentDurationVarDescription = "The identity enrollment duration in minutes" CtrlEdgeRouterEnrollmentDurationVarName = "ZITI_EDGE_ROUTER_ENROLLMENT_DURATION" CtrlEdgeRouterEnrollmentDurationVarDescription = "The router enrollment duration in minutes" - CtrlEdgeInterfaceAddressVarName = "ZITI_CTRL_EDGE_INTERFACE_ADDRESS" - CtrlEdgeInterfaceAddressVarDescription = "The interface address to bind the controller's edge listener to" - CtrlEdgeInterfacePortVarName = "ZITI_CTRL_EDGE_INTERFACE_PORT" - CtrlEdgeInterfacePortVarDescription = "The interface port to bind the controller's edge listener to" - CtrlEdgeAdvertisedAddressVarName = "ZITI_CTRL_EDGE_ADVERTISED_ADDRESS" - CtrlEdgeAdvertisedAddressVarDescription = "The publicly addressable controller address value" - CtrlEdgeAdvertisedPortVarName = "ZITI_CTRL_EDGE_ADVERTISED_PORT" - CtrlEdgeAdvertisedPortVarDescription = "The publicly addressable controller port value" CtrlPkiEdgeCertVarName = "ZITI_PKI_EDGE_CERT" CtrlPkiEdgeCertVarDescription = "Path to Identity Cert for Ziti Edge Controller" CtrlPkiEdgeServerCertVarName = "ZITI_PKI_EDGE_SERVER_CERT"