secret_hub 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +114 -6
- data/lib/secret_hub/commands/bulk.rb +5 -4
- data/lib/secret_hub/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 763f15611b0f1f269e1c957d88597f7a793ae2f8e69390f8eb720d8bc1a46a20
|
4
|
+
data.tar.gz: f1af0ee3550d0664d58fd6d0112968229f8a394a5425373fed73017ed1d6a802
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21860a561122f6c9d168b653bbbc705e0f8df4722f4bfdb79f12f36475d4f458731ef3e4367b0cdb92dd938be5ef62b16a64aff84449c8b0fc11051954a7c2ae
|
7
|
+
data.tar.gz: 1d46836c5db99f1793cf1cc9461ca1c0716761b78e1a77b4cfb585a488d162445de54f1d5ea1528511da928c258f149fc183179ef2332851c9ef8108b8fe3cc8
|
data/README.md
CHANGED
@@ -1,24 +1,132 @@
|
|
1
|
-
SecretHub
|
1
|
+
SecretHub - GitHub Secrets CLI
|
2
2
|
==================================================
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/secret_hub.svg)](https://badge.fury.io/rb/secret_hub)
|
5
|
-
[![Build Status](https://
|
6
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges
|
5
|
+
[![Build Status](https://github.com/DannyBen/secret_hub/workflows/Test/badge.svg)](https://github.com/DannyBen/secret_hub/actions?query=workflow%3ATest)
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/9ac95755c33e105ed998/maintainability)](https://codeclimate.com/github/DannyBen/secret_hub/maintainability)
|
7
7
|
|
8
8
|
---
|
9
9
|
|
10
|
-
|
10
|
+
SecretHub lets you easily manage your GitHub secrets from the command line
|
11
|
+
with support for bulk operations.
|
11
12
|
|
12
13
|
---
|
13
14
|
|
14
15
|
Installation
|
15
16
|
--------------------------------------------------
|
16
17
|
|
17
|
-
|
18
|
+
```shell
|
19
|
+
$ gem install secret_hub
|
20
|
+
```
|
18
21
|
|
19
22
|
|
23
|
+
Prerequisites
|
24
|
+
--------------------------------------------------
|
25
|
+
|
26
|
+
SecretHub is a wrapper around the [GitHub Secrets API][secrets-api]. To use
|
27
|
+
it, you need to set up your environment with a
|
28
|
+
[GitHub Access Token][access-key]:
|
29
|
+
|
30
|
+
|
31
|
+
```shell
|
32
|
+
$ export GITHUB_ACCESS_TOKEN=<your access token>
|
33
|
+
```
|
34
|
+
|
20
35
|
|
21
36
|
Usage
|
22
37
|
--------------------------------------------------
|
23
38
|
|
24
|
-
|
39
|
+
SecretHub has two families of commands:
|
40
|
+
|
41
|
+
1. Commands that operate on a single repository.
|
42
|
+
2. Commands that operate on multiple repositories, and multiple secrets.
|
43
|
+
|
44
|
+
### Single repository operations
|
45
|
+
|
46
|
+
#### Show the secret keys in a repository
|
47
|
+
|
48
|
+
```shell
|
49
|
+
# secrethub list REPO
|
50
|
+
$ secrethub list you/your-repo
|
51
|
+
```
|
52
|
+
|
53
|
+
#### Create or update a secret in a repository
|
54
|
+
|
55
|
+
```shell
|
56
|
+
# secrethub save REPO KEY VALUE
|
57
|
+
$ secrethub list you/your-repo SECRET "there is no spoon"
|
58
|
+
```
|
59
|
+
|
60
|
+
#### Delete a secret from a repository
|
61
|
+
|
62
|
+
```shell
|
63
|
+
# secrethub delete REPO KEY
|
64
|
+
$ secrethub list you/your-repo SECRET
|
65
|
+
```
|
66
|
+
|
67
|
+
### Bulk operations
|
68
|
+
|
69
|
+
All the bulk operations function by:
|
70
|
+
|
71
|
+
1. Having a config file specifying the list of repositories, and their
|
72
|
+
expected secret keys.
|
73
|
+
2. Having all the secrets set up as environment variables.
|
74
|
+
|
75
|
+
A typical config file looks like this:
|
76
|
+
|
77
|
+
```yaml
|
78
|
+
# secrethub.yml
|
79
|
+
user/repo:
|
80
|
+
- SECRET
|
81
|
+
- PASSWORD
|
82
|
+
- SECRET_KEY
|
83
|
+
|
84
|
+
user/another-repo:
|
85
|
+
- SECRET
|
86
|
+
- SECRET_KEY
|
87
|
+
```
|
88
|
+
|
89
|
+
#### Create a sample configuration file
|
90
|
+
|
91
|
+
```shell
|
92
|
+
# secrethub bulk init [CONFIG]
|
93
|
+
$ secrethub bulk init mysecrets.yml
|
94
|
+
```
|
95
|
+
|
96
|
+
#### Show all secrets in all repositories
|
97
|
+
|
98
|
+
```shell
|
99
|
+
# secrethub bulk list [CONFIG]
|
100
|
+
$ secrethub bulk list mysecrets.yml
|
101
|
+
```
|
102
|
+
|
103
|
+
#### Save multiple secrets to multiple repositories
|
104
|
+
|
105
|
+
```shell
|
106
|
+
# secrethub bulk save [CONFIG --clean]
|
107
|
+
$ secrethub bulk save mysecrets.yml --clean
|
108
|
+
```
|
109
|
+
|
110
|
+
Using the `--clean` flag, you can ensure that the repositories do not have
|
111
|
+
any secrets that you are unaware of. This flag will delete any secret that is
|
112
|
+
not specified in your config file.
|
113
|
+
|
114
|
+
#### Delete secrets from multiple repositories unless they are specified in the config file
|
115
|
+
|
116
|
+
```shell
|
117
|
+
# secrethub bulk clean [CONFIG]
|
118
|
+
$ secrethub bulk clean mysecrets.yml
|
119
|
+
```
|
120
|
+
|
121
|
+
|
122
|
+
Contributing / Support
|
123
|
+
--------------------------------------------------
|
124
|
+
|
125
|
+
If you experience any issue, have a question or a suggestion, or if you wish
|
126
|
+
to contribute, feel free to [open an issue][issues].
|
127
|
+
|
128
|
+
---
|
129
|
+
|
130
|
+
[secrets-api]: https://developer.github.com/v3/actions/secrets/
|
131
|
+
[access-key]: https://github.com/settings/tokens
|
132
|
+
[issues]: https://github.com/DannyBen/secret_hub/issues
|
@@ -6,9 +6,9 @@ module SecretHub
|
|
6
6
|
summary "Update or delete multiple secrets from multiple repositories"
|
7
7
|
|
8
8
|
usage "secrethub bulk init [CONFIG]"
|
9
|
+
usage "secrethub bulk list [CONFIG]"
|
9
10
|
usage "secrethub bulk save [CONFIG --clean]"
|
10
11
|
usage "secrethub bulk clean [CONFIG]"
|
11
|
-
usage "secrethub bulk list [CONFIG]"
|
12
12
|
usage "secrethub bulk (-h|--help)"
|
13
13
|
|
14
14
|
command "init", "Create a sample configuration file in the current directory"
|
@@ -18,12 +18,13 @@ module SecretHub
|
|
18
18
|
|
19
19
|
option "-c, --clean", "Also delete any other secret not defined in the config file"
|
20
20
|
|
21
|
-
param "CONFIG", "Path to the configuration file"
|
21
|
+
param "CONFIG", "Path to the configuration file [default: secrethub.yml]"
|
22
22
|
|
23
23
|
example "secrethub bulk init"
|
24
24
|
example "secrethub bulk clean"
|
25
|
-
example "secrethub bulk
|
26
|
-
example "secrethub bulk
|
25
|
+
example "secrethub bulk list mysecrets.yml"
|
26
|
+
example "secrethub bulk save mysecrets.yml"
|
27
|
+
example "secrethub bulk save --clean"
|
27
28
|
|
28
29
|
def init_command
|
29
30
|
raise SecretHubError, "File #{config_file} already exists" if File.exist? config_file
|
data/lib/secret_hub/version.rb
CHANGED