From c32698b510b5cfb985eefad6310abd3cac73ea61 Mon Sep 17 00:00:00 2001 From: oscarzhou Date: Mon, 26 Dec 2022 01:10:59 +1300 Subject: [PATCH] config: add comments --- go/configs/config.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/go/configs/config.go b/go/configs/config.go index 95a18fc..2a66fb7 100644 --- a/go/configs/config.go +++ b/go/configs/config.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "os" + "path" ) const ( @@ -17,13 +18,13 @@ var ( ) 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 - // VolumePath is where all the persisitant data will be saved to + // VolumePath is where all the persisitant data will be stored VolumePath string - // + // Credentials for UI login LoginCredential LoginCredential - // + // key is repository name, for example, "repository-ee" 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) { 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.Printf("Set the volume path: ") - fmt.Scanf("%s", &(config.VolumePath)) + // generate volume path automatically + config.VolumePath = path.Join(config.ProjectPath, "volumes") var loginCredential LoginCredential fmt.Printf("Set login credential username(admin): ")