Skip to content

Commit

Permalink
Merge pull request #1397 from hairyhenderson/remove-boltdb
Browse files Browse the repository at this point in the history
Remove BoltDB support
  • Loading branch information
hairyhenderson authored Jun 18, 2022
2 parents 07eaff9 + c5fc7b8 commit 6b79f2a
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 215 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ _Read the docs at [docs.gomplate.ca][docs-url], chat with developers and communi
[![Discussions][discussions-image]][discussions-url]

`gomplate` is a template renderer which supports a growing list of datasources,
such as: JSON (_including EJSON - encrypted JSON_), YAML, AWS EC2 metadata, [BoltDB](https://pkg.go.dev/go.etcd.io/bbolt),
such as: JSON (_including EJSON - encrypted JSON_), YAML, AWS EC2 metadata,
[Hashicorp Consul](https://www.consul.io/) and [Hashicorp Vault](https://www.vaultproject.io/) secrets.

Come chat with developers and community in the [#gomplate channel][] on [Gophers Slack][] and on [GitHub Discussions][discussions-url]!
Expand Down
4 changes: 1 addition & 3 deletions data/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ func (d *Data) registerReaders() {

d.sourceReaders["aws+smp"] = readAWSSMP
d.sourceReaders["aws+sm"] = readAWSSecretsManager
// Deprecated: don't use
d.sourceReaders["boltdb"] = readBoltDB
d.sourceReaders["consul"] = readConsul
d.sourceReaders["consul+http"] = readConsul
d.sourceReaders["consul+https"] = readConsul
Expand Down Expand Up @@ -148,7 +146,7 @@ type Source struct {
fs afero.Fs // used for file: URLs, nil otherwise
hc *http.Client // used for http[s]: URLs, nil otherwise
vc *vault.Vault // used for vault: URLs, nil otherwise
kv *libkv.LibKV // used for consul:, etcd:, zookeeper: & boltdb: URLs, nil otherwise
kv *libkv.LibKV // used for consul:, etcd:, zookeeper: URLs, nil otherwise
asmpg awssmpGetter // used for aws+smp:, nil otherwise
awsSecretsManager awsSecretsManagerGetter // used for aws+sm, nil otherwise
mediaType string
Expand Down
32 changes: 0 additions & 32 deletions data/datasource_boltdb.go

This file was deleted.

2 changes: 1 addition & 1 deletion docs/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ menu:
---

`gomplate` is a template renderer which supports a growing list of datasources,
such as: JSON (_including EJSON - encrypted JSON_), YAML, AWS EC2 metadata, [BoltDB](https://pkg.go.dev/go.etcd.io/bbolt),
such as: JSON (_including EJSON - encrypted JSON_), YAML, AWS EC2 metadata,
[Hashicorp Consul](https://www.consul.io/) and [Hashicorp Vault](https://www.vaultproject.io/) secrets.

Come chat with developers and community in the [#gomplate channel][] on [Gophers Slack][] and on [GitHub Discussions][discussions-url]!
Expand Down
30 changes: 1 addition & 29 deletions docs/content/datasources.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ For our purposes, the _scheme_ and the _path_ components are especially importan
| _authority_ | Used only by remote datasources, and can be omitted in some of those cases. Consists of _userinfo_ (`user:pass`), _host_, and _port_. |
| _path_ | Can be omitted, but usually used as the basis of the locator for the datasource. If the path ends with a `/` character, [directory](#directory-datasources) semantics are used. |
| _query_ | Used rarely for datasources where information must be provided in order to get a reasonable reply (such as generating dynamic secrets with Vault), or for [overriding MIME types](#overriding-mime-types) |
| _fragment_ | Used rarely for accessing a subset of the given path (such as a bucket name in a BoltDB database) |
| _fragment_ | Used rarely for accessing a subset of the given path |

### Opaque URIs

Expand All @@ -58,7 +58,6 @@ Gomplate supports a number of datasources, each specified with a particular URL
| [AWS Systems Manager Parameter Store](#using-aws-smp-datasources) | `aws+smp` | [AWS Systems Manager Parameter Store][AWS SMP] is a hierarchically-organized key/value store which allows storage of text, lists, or encrypted secrets for retrieval by AWS resources |
| [AWS Secrets Manager](#using-aws-sm-datasource) | `aws+sm` | [AWS Secrets Manager][] helps you protect secrets needed to access your applications, services, and IT resources. |
| [Amazon S3](#using-s3-datasources) | `s3` | [Amazon S3][] is a popular object storage service. |
| [BoltDB](#using-boltdb-datasources) | `boltdb` | [BoltDB][] is a simple local key/value store used by many Go tools |
| [Consul](#using-consul-datasources) | `consul`, `consul+http`, `consul+https` | [HashiCorp Consul][] provides (among many other features) a key/value store |
| [Environment](#using-env-datasources) | `env` | Environment variables can be used as datasources - useful for testing |
| [File](#using-file-datasources) | `file` | Files can be read in any of the [supported formats](#mime-types), including by piping through standard input (`Stdin`). [Directories](#directory-datasources) are also supported. |
Expand Down Expand Up @@ -309,32 +308,6 @@ $ gomplate -d bucket=s3://my-bucket/?region=eu-west-1&endpoint=my-test-site& -i
Hello world
```

## Using `boltdb` datasources

[BoltDB][] is a simple local key/value store used by many Go tools. The `boltdb://` scheme can be used to access values stored in a BoltDB database file. The full path is provided in the URL, and the bucket name can be specified using a URL fragment (e.g. `boltdb:///tmp/database.db#bucket`).

**Note:** Access is implemented through [`libkv`](https://github.com/docker/libkv), and as such, the first 8 bytes of all values are used as an incrementing last modified index value. All values must therefore be at least 9 bytes long, with the first 8 being ignored.

The following environment variables can be set:

| name | usage |
|------|-------|
| `BOLTDB_TIMEOUT` | Timeout (in seconds) to wait for a lock on the database file when opening. |
| `BOLTDB_PERSIST` | If set keep the database open instead of closing after each read. Any value acceptable to [`strconv.ParseBool`](https://golang.org/pkg/strconv/#ParseBool) can be provided. |

### URL Considerations

For `boltdb`, the _scheme_, _path_, and _fragment_ are used.

The _path_ must point to a BoltDB database on the local file system, while the _fragment_ must provide the name of the bucket to use.

### Example

```console
$ gomplate -d config=boltdb:///tmp/config.db#Bucket1 -i '{{(datasource "config" "foo")}}'
bar
```

## Using `consul` datasources

Gomplate supports retrieving data from [HashiCorp Consul][]'s [KV Store](https://www.consul.io/api/kv.html).
Expand Down Expand Up @@ -778,7 +751,6 @@ The file `/tmp/vault-aws-nonce` will be created if it didn't already exist, and

[AWS SMP]: https://aws.amazon.com/systems-manager/features#Parameter_Store
[AWS Secrets Manager]: https://aws.amazon.com/secrets-manager
[BoltDB]: https://pkg.go.dev/go.etcd.io/bbolt
[HashiCorp Consul]: https://consul.io
[HashiCorp Vault]: https://vaultproject.io
[JSON]: https://json.org
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ require (
github.com/stretchr/testify v1.7.2
github.com/ugorji/go/codec v1.2.7
github.com/zealic/xignore v0.3.3
go.etcd.io/bbolt v1.3.6
gocloud.dev v0.25.1-0.20220408200107-09b10f7359f7
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,6 @@ github.com/zealic/xignore v0.3.3 h1:EpLXUgZY/JEzFkTc+Y/VYypzXtNz+MSOMVCGW5Q4CKQ=
github.com/zealic/xignore v0.3.3/go.mod h1:lhS8V7fuSOtJOKsvKI7WfsZE276/7AYEqokv3UiqEAU=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
go.opencensus.io v0.15.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
Expand Down Expand Up @@ -1042,7 +1040,6 @@ golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200828194041-157a740278f4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
55 changes: 0 additions & 55 deletions internal/tests/integration/datasources_boltdb_test.go

This file was deleted.

42 changes: 0 additions & 42 deletions libkv/boltdb.go

This file was deleted.

48 changes: 0 additions & 48 deletions libkv/boltdb_test.go

This file was deleted.

0 comments on commit 6b79f2a

Please sign in to comment.