@@ -226,7 +226,7 @@ func (cmd *InitCmd) determineAppConfig() {
226226 cmd .addPortForwarding (portInt )
227227 }
228228 }
229- cmd .addSyncPath ()
229+ cmd .addDefaultSyncConfig ()
230230
231231 /* TODO
232232 cmd.appConfig.External.Domain = stdinutil.GetFromStdin(&stdinutil.GetFromStdinParams{
@@ -237,42 +237,45 @@ func (cmd *InitCmd) determineAppConfig() {
237237}
238238
239239func (cmd * InitCmd ) addPortForwarding (port int ) {
240- OUTER:
241- for _ , portForwarding := range cmd .config .DevSpace .PortForwarding {
242- for _ , portMapping := range portForwarding .PortMappings {
240+ for _ , portForwarding := range * cmd .config .DevSpace .PortForwarding {
241+ for _ , portMapping := range * portForwarding .PortMappings {
243242 if * portMapping .RemotePort == port {
244- cmd .config .DevSpace .PortForwarding = append (cmd .config .DevSpace .PortForwarding , & v1.PortForwardingConfig {
245- PortMappings : []* v1.PortMapping {
246- {
247- LocalPort : & port ,
248- RemotePort : & port ,
249- },
250- },
251- ResourceType : configutil .String ("pod" ),
252- LabelSelector : map [string ]* string {
253- "release" : cmd .config .DevSpace .Release .Name ,
254- },
255- })
256- break OUTER
243+ return
257244 }
258245 }
259246 }
247+
248+ portForwarding := append (* cmd .config .DevSpace .PortForwarding , & v1.PortForwardingConfig {
249+ PortMappings : & []* v1.PortMapping {
250+ {
251+ LocalPort : & port ,
252+ RemotePort : & port ,
253+ },
254+ },
255+ ResourceType : configutil .String ("pod" ),
256+ LabelSelector : & map [string ]* string {
257+ "release" : cmd .config .DevSpace .Release .Name ,
258+ },
259+ })
260+ cmd .config .DevSpace .PortForwarding = & portForwarding
260261}
261262
262- func (cmd * InitCmd ) addSyncPath () {
263- for _ , syncPath := range cmd .config .DevSpace .Sync {
263+ func (cmd * InitCmd ) addDefaultSyncConfig () {
264+ for _ , syncPath := range * cmd .config .DevSpace .Sync {
264265 if * syncPath .LocalSubPath == "./" || * syncPath .ContainerPath == "/app" {
265- cmd .config .DevSpace .Sync = append (cmd .config .DevSpace .Sync , & v1.SyncConfig {
266- ContainerPath : configutil .String ("/app" ),
267- LocalSubPath : configutil .String ("./" ),
268- ResourceType : configutil .String ("pod" ),
269- LabelSelector : map [string ]* string {
270- "release" : cmd .config .DevSpace .Release .Name ,
271- },
272- })
273- break
266+ return
274267 }
275268 }
269+
270+ syncConfig := append (* cmd .config .DevSpace .Sync , & v1.SyncConfig {
271+ ContainerPath : configutil .String ("/app" ),
272+ LocalSubPath : configutil .String ("./" ),
273+ ResourceType : configutil .String ("pod" ),
274+ LabelSelector : & map [string ]* string {
275+ "release" : cmd .config .DevSpace .Release .Name ,
276+ },
277+ })
278+ cmd .config .DevSpace .Sync = & syncConfig
276279}
277280
278281func (cmd * InitCmd ) reconfigure () {
@@ -352,7 +355,7 @@ func (cmd *InitCmd) reconfigure() {
352355
353356func (cmd * InitCmd ) reconfigureRegistry () {
354357 overwriteConfig := configutil .GetOverwriteConfig ()
355- registryConfig := overwriteConfig .Services .Registry
358+ registryConfig := cmd . config .Services .Registry
356359
357360 enableAutomaticBuilds := stdinutil .GetFromStdin (& stdinutil.GetFromStdinParams {
358361 Question : "Do you want to enable automatic Docker image building?" ,
@@ -405,10 +408,39 @@ func (cmd *InitCmd) reconfigureRegistry() {
405408 }
406409 registryUser .Password = & randomPassword
407410 }
408- registryReleaseValues := registryConfig . Internal . Release . Values
411+ var registryReleaseValues map [ interface {}] interface {}
409412
410- if registryReleaseValues == nil {
413+ if registryConfig .Internal .Release .Values != nil {
414+ registryReleaseValues = * registryConfig .Internal .Release .Values
415+ } else {
411416 registryReleaseValues = map [interface {}]interface {}{}
417+
418+ registryDomain := stdinutil .GetFromStdin (& stdinutil.GetFromStdinParams {
419+ Question : "Which domain should your container registry be using? (optional, requires an ingress controller)" ,
420+ ValidationRegexPattern : "^(([a-z0-9]([a-z0-9-]{0,120}[a-z0-9])?\\ .)+[a-z0-9]{2,})?$" ,
421+ })
422+
423+ if * registryDomain != "" {
424+ registryReleaseValues = map [interface {}]interface {}{
425+ "Ingress" : map [string ]interface {}{
426+ "Enabled" : true ,
427+ "Hosts" : []string {
428+ * registryDomain ,
429+ },
430+ "Annotations" : map [string ]string {
431+ "Kubernetes.io/tls-acme" : "true" ,
432+ },
433+ "Tls" : []map [string ]interface {}{
434+ map [string ]interface {}{
435+ "SecretName" : "tls-devspace-registry" ,
436+ "Hosts" : []string {
437+ * registryDomain ,
438+ },
439+ },
440+ },
441+ },
442+ }
443+ }
412444 }
413445 secrets , registryHasSecrets := registryReleaseValues ["secrets" ]
414446
@@ -425,6 +457,7 @@ func (cmd *InitCmd) reconfigureRegistry() {
425457 secretMap ["htpasswd" ] = ""
426458 }
427459 }
460+ registryConfig .Internal .Release .Values = & registryReleaseValues
428461 }
429462 }
430463}
@@ -439,12 +472,15 @@ func (cmd *InitCmd) determineLanguage() {
439472 }
440473
441474 if len (cmd .chartGenerator .Language ) == 0 {
475+ log .StartWait ("Detecting programming language" )
476+
442477 cmd .chartGenerator .Language , _ = cmd .chartGenerator .GetLanguage ()
443478 supportedLanguages , err := cmd .chartGenerator .GetSupportedLanguages ()
444479
445480 if cmd .chartGenerator .Language == "" {
446481 cmd .chartGenerator .Language = "none"
447482 }
483+ log .StopWait ()
448484
449485 if err != nil {
450486 log .Fatalf ("Unable to get supported languages: %s" , err .Error ())
0 commit comments