Skip to content

Commit 64195b7

Browse files
authored
Merge pull request #53 from bpineau/no_git
New "--no-git" mode (don't version objects)
2 parents 6056e62 + 878f20b commit 64195b7

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This provides real time, continuous backups, and keeps detailled changes history
1212

1313
To dump the cluster content once and exit:
1414
```bash
15-
katafygio --dump-only --local-dir /tmp/clusterdump/
15+
katafygio --no-git --dump-only --local-dir /tmp/clusterdump/
1616
```
1717

1818
To create a local git repository and continuously save the cluster content:
@@ -73,6 +73,7 @@ Flags:
7373
-v, --log-level string Log level (default "info")
7474
-o, --log-output string Log output (default "stderr")
7575
-r, --log-server string Log server (if using syslog)
76+
-n, --no-git Don't version with git
7677
-i, --resync-interval int Full resync interval in seconds (0 to disable) (default 900)
7778
```
7879

cmd/execute.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ func runE(cmd *cobra.Command, args []string) (err error) {
5555
return fmt.Errorf("Can't create directory %s: %v", localDir, err)
5656
}
5757

58-
repo, err := git.New(logger, dryRun, localDir, gitURL).Start()
58+
var repo *git.Store
59+
if !noGit {
60+
repo, err = git.New(logger, dryRun, localDir, gitURL).Start()
61+
}
5962
if err != nil {
6063
return fmt.Errorf("failed to start git repo handler: %v", err)
6164
}
@@ -74,9 +77,11 @@ func runE(cmd *cobra.Command, args []string) (err error) {
7477
}
7578

7679
obsv.Stop()
77-
repo.Stop()
7880
reco.Stop()
7981
http.Stop()
82+
if !noGit {
83+
repo.Stop()
84+
}
8085

8186
return nil
8287
}

cmd/flags.go

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var (
2323
resyncInt int
2424
exclkind []string
2525
exclobj []string
26+
noGit bool
2627
)
2728

2829
func bindPFlag(key string, cmd string) {
@@ -82,6 +83,9 @@ func init() {
8283

8384
RootCmd.PersistentFlags().IntVarP(&resyncInt, "resync-interval", "i", 900, "Full resync interval in seconds (0 to disable)")
8485
bindPFlag("resync-interval", "resync-interval")
86+
87+
RootCmd.PersistentFlags().BoolVarP(&noGit, "no-git", "n", false, "Don't version with git")
88+
bindPFlag("no-git", "no-git")
8589
}
8690

8791
// for whatever the reason, viper don't auto bind values from config file so we have to tell him
@@ -100,4 +104,5 @@ func bindConf(cmd *cobra.Command, args []string) {
100104
resyncInt = viper.GetInt("resync-interval")
101105
exclkind = viper.GetStringSlice("exclude-kind")
102106
exclobj = viper.GetStringSlice("exclude-object")
107+
noGit = viper.GetBool("no-git")
103108
}

0 commit comments

Comments
 (0)