aboutsummaryrefslogtreecommitdiff
path: root/docker/bckp/kv_to_s3.go
blob: 76dc0d721b4ce549048ed1c064b504212dc32c55 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
  "github.com/hashicorp/consul/api"
  /*"crypto/aes"*/
  "log"
  /*"github.com/aws/aws-sdk-go/service/s3"*/
)

func errIsPanic(err error, format string, a ...interface{}) {
  if err != nil {
    log.Panicf(format, a...)
  }
}

func main() {
  log.Println("starting consul kv backup...")
  conf := api.DefaultConfig()
  //@FIXME add later support for a different URL
  //@FIXME add later support for HTTPS

  options := api.QueryOptions {
    // Prevent from backuping forever silently a desynchronized node
    AllowStale: false,
  }

  consul, err := api.NewClient(conf)
  errIsPanic(err, "Unable to build a new client. %v", err)

  _, _, err = consul.Snapshot().Save(&options)
  errIsPanic(err, "Snapshot failed. %v", err)



}