config: add comments
This commit is contained in:
		
							parent
							
								
									d8431550f3
								
							
						
					
					
						commit
						c32698b510
					
				@ -6,6 +6,7 @@ import (
 | 
				
			|||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
						"path"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
@ -17,13 +18,13 @@ var (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Config struct {
 | 
					type Config struct {
 | 
				
			||||||
	// ProjectPath is where all git repositories will be downloaded to
 | 
						// ProjectPath is the location on your host where all dev relevant folders will be stored to
 | 
				
			||||||
	ProjectPath string
 | 
						ProjectPath string
 | 
				
			||||||
	// VolumePath is where all the persisitant data will be saved to
 | 
						// VolumePath is where all the persisitant data will be stored
 | 
				
			||||||
	VolumePath string
 | 
						VolumePath string
 | 
				
			||||||
	//
 | 
						// Credentials for UI login
 | 
				
			||||||
	LoginCredential LoginCredential
 | 
						LoginCredential LoginCredential
 | 
				
			||||||
	//
 | 
						// key is repository name, for example, "repository-ee"
 | 
				
			||||||
	RepositoryConfig map[string]RepositoryConfig
 | 
						RepositoryConfig map[string]RepositoryConfig
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -72,13 +73,16 @@ func (config *Config) Summarize() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// initializeConfig will set up the mandatory dev information for the first time.
 | 
				
			||||||
 | 
					// such as devtool path, login credential
 | 
				
			||||||
 | 
					// The configuration also can be updated later
 | 
				
			||||||
func initializeConfig(w io.WriteCloser) (*Config, error) {
 | 
					func initializeConfig(w io.WriteCloser) (*Config, error) {
 | 
				
			||||||
	config := &Config{}
 | 
						config := &Config{}
 | 
				
			||||||
	fmt.Printf("Set the project path: ")
 | 
						fmt.Printf("Initialize devtool path:\n (Project path will store volumes and repositories)")
 | 
				
			||||||
	fmt.Scanf("%s", &(config.ProjectPath))
 | 
						fmt.Scanf("%s", &(config.ProjectPath))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fmt.Printf("Set the volume path: ")
 | 
						// generate volume path automatically
 | 
				
			||||||
	fmt.Scanf("%s", &(config.VolumePath))
 | 
						config.VolumePath = path.Join(config.ProjectPath, "volumes")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var loginCredential LoginCredential
 | 
						var loginCredential LoginCredential
 | 
				
			||||||
	fmt.Printf("Set login credential username(admin): ")
 | 
						fmt.Printf("Set login credential username(admin): ")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user