Installer: Make Private network optional
Change-Id: Ic7a2e5250a42dc03de2416b1e2a0d1bbca3f010c
diff --git a/core/installer/welcome/env.go b/core/installer/welcome/env.go
index 949cbe0..4c084cd 100644
--- a/core/installer/welcome/env.go
+++ b/core/installer/welcome/env.go
@@ -239,11 +239,12 @@
}
type createEnvReq struct {
- Name string
- ContactEmail string `json:"contactEmail"`
- Domain string `json:"domain"`
- AdminPublicKey string `json:"adminPublicKey"`
- SecretToken string `json:"secretToken"`
+ Name string
+ ContactEmail string `json:"contactEmail"`
+ Domain string `json:"domain"`
+ PrivateNetworkSubdomain string `json:"privateNetworkSubdomain"`
+ AdminPublicKey string `json:"adminPublicKey"`
+ SecretToken string `json:"secretToken"`
}
func (s *EnvServer) readInvitations() ([]invitation, error) {
@@ -295,6 +296,9 @@
if req.Domain, err = getFormValue(r.PostForm, "domain"); err != nil {
return err
}
+ if req.PrivateNetworkSubdomain, err = getFormValue(r.PostForm, "private-network-subdomain"); err != nil {
+ return err
+ }
if req.ContactEmail, err = getFormValue(r.PostForm, "contact-email"); err != nil {
return err
}
@@ -385,11 +389,15 @@
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
+ privateDomain := ""
+ if req.PrivateNetworkSubdomain != "" {
+ privateDomain = fmt.Sprintf("%s.%s", req.PrivateNetworkSubdomain, req.Domain)
+ }
env := installer.EnvConfig{
Id: req.Name,
InfraName: infra.Name,
Domain: req.Domain,
- PrivateDomain: fmt.Sprintf("p.%s", req.Domain),
+ PrivateDomain: privateDomain,
ContactEmail: req.ContactEmail,
AdminPublicKey: req.AdminPublicKey,
PublicIP: infra.PublicIP,