Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,12 @@ objinsync pull --once s3://bucket/keyprefix ./localdir
To use with [Minio](https://docs.min.io/) instead of S3, you can set
`--s3-endpoint` and `--disable-ssl` flags for `pull` command as you see fit.

The `-i` or `--interval` flags allows to configure the pull time interval, which is 5 seconds by default:

```bash
objinsync pull --interval 20s s3://bucket/keyprefix ./localdir
```

---

Enable debug logs by setting the `DEBUG` environment variable `DEBUG=1 objinsync pull ...`
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,6 +28,7 @@ var (
FlagDefaultFileMode = "0664"
FlagS3Endpoint = ""
FlagDisableSSL = false
FlagPullInterval = time.Second * 5

metricsSyncTime = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "objinsync",
Expand DownExpand Up@@ -98,7 +99,7 @@ func main(){
Run: func(cmd *cobra.Command, args []string){
remoteUri := args[0]
localDir := args[1]
interval := time.Second * 5
interval := FlagPullInterval

puller, err := sync.NewPuller(remoteUri, localDir)
if err != nil{
Expand DownExpand Up@@ -177,6 +178,8 @@ func main(){
&FlagDefaultFileMode, "default-file-mode", "m", "0664", "default mode to use for creating local file")
pullCmd.PersistentFlags().StringVarP(
&FlagS3Endpoint, "s3-endpoint", "", "", "override endpoint to use for remote object store (e.g. minio)")
pullCmd.PersistentFlags().DurationVarP(
&FlagPullInterval, "interval", "i", time.Second * 5, "Interval between remote storage pulls")

rootCmd.AddCommand(pullCmd)
rootCmd.Execute()
Expand Down