Skip to content

Commit 745d5d4

Browse files
authored
Merge pull request #2 from dwaynebradley/main
Remove topic overlap between the database and application topics
2 parents 72ec40e + e16d56e commit 745d5d4

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

README.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@ Piggy Bank is a secrets storage tool for applications that works with NATS. Secr
44

55
A decryption key is returned from the initialization phase. If this key is lost, all of the data is unrecoverable.
66

7+
## Add KV bucket
8+
9+
Be sure to add the KV bucket to NATS: `nats kv add piggybank`
10+
711
## Example Usage
812

913
1. Start piggybank `piggybank start`
10-
2. Initialize the database `nats req piggybank.database.initialize ""`
11-
3. Unlock the database with key sent from step 1 `nats req piggybank.database.unlock '{"database_key": "foobar"}'`
14+
2. Initialize the database `nats req piggybankdb.initialize ""`
15+
3. Unlock the database with key sent from step 1 `nats req piggybankdb.unlock '{"database_key": "foobar"}'`
1216
4. Add a secret for an application `nats req -H method:post piggybank.myapplication.registrySecret "somesecrettext"`
13-
5. Retrieve a secret `nats req -H method:get piggybank.myapplication.registrySecret`
14-
6. Lock the database `nats req piggybank.database.lock ""`
15-
7. Try to retrieve the secret again `nats req -H method:get piggybank.myapplication.registrySecret`
17+
5. Retrieve a secret `nats req -H method:get piggybank.myapplication.registrySecret ""`
18+
6. Lock the database `nats req piggybankdb.lock ""`
19+
7. Try to retrieve the secret again `nats req -H method:get piggybank.myapplication.registrySecret ""`
1620

1721
## Permissions
1822
Permissions are defined as normal NATS subject permissions. If you have access to a subject, then you can retrieve the secrets. This means the permissions can be as granular as desired.
1923

2024
## Config
2125
Piggy Bank requires a config file. It uses Cue to read the configs, but the configs can also be in json or yaml format.
2226

23-
The Cue schema is in `cmd/schema.cue`.
27+
The Cue schema is in `cmd/schema.cue`.

server/nats.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (n *NatsBackend) SetupMicro() error {
7070
return err
7171
}
7272

73-
databaseGroup := srv.AddGroup("piggybank.database")
73+
databaseGroup := srv.AddGroup("piggybankdb")
7474
if err := databaseGroup.AddEndpoint("lock", micro.HandlerFunc(n.LockRequest)); err != nil {
7575
return err
7676
}

0 commit comments

Comments
 (0)