summaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-03 10:04:14 -0500
committerJeff Carr <[email protected]>2025-10-03 10:04:14 -0500
commit57212b9b5c5705d088446a9830c34973300a5ac3 (patch)
treeb252518889c7781fd6b5c2900fbab4acc0341405 /config.go
parent6a1f7098d7caff6c34485b6ea8dd0876f4ab09d8 (diff)
add some config examplesv0.0.160v0.0.159v0.0.158
Diffstat (limited to 'config.go')
-rw-r--r--config.go55
1 files changed, 47 insertions, 8 deletions
diff --git a/config.go b/config.go
index 88142bc..348c053 100644
--- a/config.go
+++ b/config.go
@@ -30,6 +30,16 @@ func (f *Forge) ConfigSave() error {
log.Info("This is not forge")
return log.Errorf("Only forge can save the forge config file")
}
+
+ // migrate from the old gopath to "namespace"
+ for fc := range f.Config.IterAll() {
+ if fc.Namespace != "" {
+ continue
+ }
+ if fc.Namespace != fc.GoPath {
+ fc.Namespace = fc.GoPath
+ }
+ }
log.Info("Okay, this is", prep.AppName())
if err := f.Config.ConfigSave(); err != nil {
@@ -63,18 +73,23 @@ func (cfg *ForgeConfigs) ConfigSave() error {
}
func (cfg *ForgeConfigs) DumpENV() {
- log.Infof("CfgPB.Filename = %s\n", cfg.Filename)
- log.Infof("CfgPB.ReposPB = %s\n", cfg.ReposPB)
- log.Infof("CfgPB.ReposDir = %s\n", cfg.ReposDir)
- log.Infof("CfgPB.PatchPB = %s\n", cfg.PatchPB)
- log.Infof("CfgPB.ForgeURL = %s\n", cfg.ForgeURL)
+ log.Info("s/DumpENV/DumpPB/")
+ cfg.DumpPB()
+}
+
+func (cfg *ForgeConfigs) DumpPB() {
+ log.Infof("Config.Filename = %s\n", cfg.Filename)
+ log.Infof("Config.ReposPB = %s\n", cfg.ReposPB)
+ log.Infof("Config.ReposDir = %s\n", cfg.ReposDir)
+ log.Infof("Config.PatchPB = %s\n", cfg.PatchPB)
+ log.Infof("Config.ForgeURL = %s\n", cfg.ForgeURL)
if cfg.GoWork {
- log.Infof("CfgPB.GoWork = %v\n", cfg.GoWork)
+ log.Infof("Config.GoWork = %v\n", cfg.GoWork)
}
if cfg.Mode != ForgeMode_UNKNOWN {
- log.Infof("CfgPB.Mode = %s\n", cfg.Mode)
+ log.Infof("Config.Mode = %s\n", cfg.Mode)
}
- // log.Infof("CfgPB.Hostname=%s\n", cfg.Hostname)
+ // log.Infof("ConfigCfgPB.Hostname=%s\n", cfg.Hostname)
}
/*
@@ -127,6 +142,7 @@ func loadStdConfig() *ForgeConfigs {
cfg.PatchPB = filepath.Join(cfgdir, "patches.pb")
cfg.ForgeURL = "http://forge.wit.com/"
+ cfg.addSampleConfigs()
cfg.DumpENV()
config.SetChanged("forge", true)
if !fhelp.QuestionUser("This is your first time using forge, use these default values?") {
@@ -138,3 +154,26 @@ func loadStdConfig() *ForgeConfigs {
}
return cfg
}
+
+// first time user. add go.wit.com as an example
+func (cfg *ForgeConfigs) addSampleConfigs() {
+ newc := new(ForgeConfig)
+ newc.GoPath = "go.wit.com"
+ newc.Writable = true
+ newc.Directory = true
+ cfg.Append(newc)
+
+ newc = new(ForgeConfig)
+ newc.GoPath = "priv.wit.com/corp"
+ newc.Writable = true
+ newc.Private = true
+ newc.Directory = true
+ cfg.Append(newc)
+
+ newc = new(ForgeConfig)
+ newc.GoPath = "priv.wit.com/corp"
+ newc.Writable = true
+ newc.Private = true
+ newc.Directory = true
+ cfg.Append(newc)
+}