diff --git a/config.go b/config.go index 247de89..3970f8c 100644 --- a/config.go +++ b/config.go @@ -43,7 +43,7 @@ func (f *ForgeConfigs) ConfigSave() error { log.Info("proto.Marshal() failed len", len(data), err) return err } - log.Info("forgepb.ConfigSave() proto.Marshal() worked len", len(data)) + // log.Info("forgepb.ConfigSave() proto.Marshal() worked len", len(data)) s := f.FormatTEXT() configWrite("forge.text", []byte(s)) diff --git a/configBackup.go b/configBackup.go index d9bc396..137cb08 100644 --- a/configBackup.go +++ b/configBackup.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "log" "os" "path/filepath" "time" @@ -15,12 +14,8 @@ import ( func backupConfig() error { // make a new dir to backup the files - now := time.Now() - // timestamp := now.Format("2022.07.18.190545") // 50yr shout out to K&R - timestamp := now.Format("2006.01.02.150405") // bummer. other date doesn't work? srcDir := filepath.Join(os.Getenv("FORGE_CONFIG")) - destDir := filepath.Join(os.Getenv("FORGE_CONFIG"), timestamp) - + destDir := filepath.Join(os.Getenv("FORGE_CONFIG"), "backup") return backupFiles(srcDir, destDir) } @@ -44,7 +39,7 @@ func backupFiles(srcDir string, destDir string) error { continue } - log.Println("backing up file", entry.Name()) + // log.Println("backing up file", entry.Name()) srcPath := filepath.Join(srcDir, entry.Name()) destPath := filepath.Join(destDir, entry.Name()) @@ -64,6 +59,9 @@ func copyFile(src, dest string) error { } defer srcFile.Close() + now := time.Now() + timestamp := now.Format("2006.01.02.150405") // bummer. other date doesn't work? + dest = dest + timestamp destFile, err := os.Create(dest) if err != nil { return err