trixie 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe98b3f0bf37304b30f8128a4d9de6c42db4bbdae41054f1fd4f135003337a64
4
- data.tar.gz: 4970d509ce2c73acaf0be36d7401179bc5a56461507306bd4789317ada2841e7
3
+ metadata.gz: 4601cd84921ad3fca11a80ffb627ef4b5d44d9a404dc25ac1905d75ab12a0b96
4
+ data.tar.gz: fcd3bb97d53845a6cd7752c90305bd9641c7809d57e86fc2d9fd4a6bcab41e96
5
5
  SHA512:
6
- metadata.gz: 0a1cdb36ed57e082a2bec90c58e0f85d49a84a8ea0a926c0ca90b80e4a71c5b5a4e08431aa2b2c1ed98579b606960543a5d94ee3a2f2255404e7b6436bf68ab6
7
- data.tar.gz: f65d4e4c2cd6aff21bb9fb4f0a049825ddc5dd148666769c3b4b0107513c08da4817ec232b6074e25cc7315bc36defc30646c14ec85f49b60a95a25366c77294
6
+ metadata.gz: 558dbef73b15724f9559e64d9f20cfa736fddea2445d8a9edd7c7a8bd9ee514a4c8a244356095c470787e509df6af58c29a99525bd96f5ef94d718a287e75852
7
+ data.tar.gz: 8327f5fa9e8392e563e888fd981760ac6ec78438de8a28cf8b0c83691c8748dcdb6fd6156457977132421e6780b157c1eae17d5ab59ffd9921486e3f6345d732
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trixie (0.1.3)
4
+ trixie (0.1.4)
5
5
  dry-cli (~> 0.7.0)
6
6
  dry-schema (~> 1.10.0)
7
7
  dry-validation (~> 1.8.0)
data/README.md CHANGED
@@ -18,7 +18,20 @@ secrets:
18
18
  value: "{{ op://Developers/NPM_TOKEN/SETUP_SECRET/value }}"
19
19
  ```
20
20
 
21
- Then you can run `trixie load > .env.secrets` to update your env file with the `NPM_TOKEN`
21
+ Then you can run `trixie load > .env.secrets` to update your env file with the `NPM_TOKEN`.
22
+
23
+ Alternatively, you can also leverage the following environment variables:
24
+ - TRIXIE_OP_ADDRESS - sets the authentication address for 1Password
25
+ - TRIXIE_OP_EMAIL - sets the user email address for 1Password
26
+
27
+ Example:
28
+ ```ssh
29
+ TRIXIE_OP_ADDRESS=https://{account}.1password.com \
30
+ TRIXIE_OP_EMAIL=john.doe@email.com \
31
+ trixie load > .env.secrets
32
+ ```
33
+ this will populate your env file with:
34
+ `export NPM_TOKEN={toptals-read-only-npm-token}`
22
35
 
23
36
  ### Groups
24
37
 
@@ -70,8 +83,7 @@ Or install it yourself as:
70
83
  ## TODO IDEAS
71
84
 
72
85
  1. Support Multiple Backends/Password Managers, Trixie::Loader can be refactored to be an adapter for the op CLI
73
- 2. Allow specific Backend options, eg: trixie load --backend op --backend-options '{ "email": "bar@foo.com", "address": "foo.1password.com"}'
74
- 3. Add a load --cache option, so fetched secrets could be retained for a while without using the Password Manager Backend
86
+ 2. Add a load --cache option, so fetched secrets could be retained for a while without using the Password Manager Backend
75
87
 
76
88
  ## Development
77
89
 
data/lib/trixie/load.rb CHANGED
@@ -4,6 +4,8 @@ module Trixie
4
4
  # Fetches the specified secrets with op cli and returns them formatted
5
5
  class Load
6
6
  OP_NOT_INSTALLED = "op cli is not installed please download and install at https://developer.1password.com/docs/cli/get-started#install"
7
+ OP_ADDRESS_ENV = "TRIXIE_OP_ADDRESS"
8
+ OP_EMAIL_ENV = "TRIXIE_OP_EMAIL"
7
9
 
8
10
  def initialize(file:, groups: [], format: "env")
9
11
  @file = file
@@ -38,7 +40,7 @@ module Trixie
38
40
  warn "* Configuring 1password Account"
39
41
  warn "To get the Secret Key take a look at https://support.1password.com/secret-key/"
40
42
 
41
- `op account add`
43
+ add_op_account
42
44
  end
43
45
 
44
46
  def fetch_secrets
@@ -58,5 +60,14 @@ module Trixie
58
60
  def formatted_secrets
59
61
  @formatter.call(filtered_secrets)
60
62
  end
63
+
64
+ def add_op_account
65
+ cmd = "op account add"
66
+
67
+ cmd += " --address #{ENV[OP_ADDRESS_ENV]}" if ENV[OP_ADDRESS_ENV]
68
+ cmd += " --email #{ENV[OP_EMAIL_ENV]}" if ENV[OP_EMAIL_ENV]
69
+
70
+ `#{cmd}`
71
+ end
61
72
  end
62
73
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Trixie
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trixie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toptal, LLC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-08 00:00:00.000000000 Z
11
+ date: 2022-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-cli