voltos 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: 43fd3512151f184d1c2787b5ab1d2114a7e8a57d
4
- data.tar.gz: 5ce65cddbe0bf0ace798da5b2fe3a8d0ad059ef9
3
+ metadata.gz: f4a9232be59e0741a341ca3a1943193065ac1f30
4
+ data.tar.gz: 834922be6fa5007ab33c003a7d6db02844d67ec0
5
5
  SHA512:
6
- metadata.gz: e62cc432dc00c766cf3ca3a167bcbd8b77e7325ca4397cb3956c0d33470d0fc478d947ff0e7b8d170a885354d24b62b92a31b33311bd4ee48397f6f8dc4cfc98
7
- data.tar.gz: c959f9d4980cff8df0382447c76605a523c6cae402c266bbd85d63891223a9b69cf74a915942d5b763aaea2efb40f20d345651695b4bf652fe5dd498e7346d3b
6
+ metadata.gz: 05c840cf8ee45113e9947f59244910bedb483232bf8c4be518e9091bce98a9511c653971f3a34860f34d4207d32cc21770674ac50df41a7926e7012347fcd67f
7
+ data.tar.gz: ea54395afa3f468b0e50b3a91f9223a974a91eca82509cf4f397919cd70cf59d115306eb2353a354e321deeb1cfbedb60ecc8739d733a4ff84f57171c34e35f5
data/README.md CHANGED
@@ -20,53 +20,22 @@ Or install it yourself as:
20
20
 
21
21
  ## Getting started
22
22
 
23
- 1. Find your unique Voltos API key. See "Account" settings.
23
+ 1. Find your unique Voltos API key. See "Bundle" settings.
24
24
 
25
25
  2. Set this key as an environment variable, e.g.
26
26
  ```ruby
27
27
  $ export VOLTOS_KEY=13579def13579def
28
-
28
+
29
29
  # or on a platform like Heroku
30
- $ heroku config:set VOLTOS_KEY=13579def13579def
30
+ $ heroku config:set VOLTOS_KEY=13579def13579def
31
31
  ```
32
32
  We'll use this key to load up our Voltos credentials (don't worry, you'll only need to set one key this way).
33
-
34
- 3. Load up the Voltos credentials. You'll probably want them early on, prior to where your trying to use them (e.g. in ``environment.rb`` in Rails).
35
- ```ruby
36
- Voltos.configure do |config|
37
- config.api_key = ENV["VOLTOS_KEY"]
38
- end
39
-
40
- # load all the bundles of credentials for that API key
41
- Voltos.load
42
-
43
- # access the credential "MAILER_API_TOKEN" that's in the "myapp-prod" bundle
44
- ENV["MAILER_API_TOKEN"] = Voltos.key("myapp-prod", "MAILER_API_TOKEN")
45
- ```
46
- Note that we're grabbing the credential and stashing it in an environment variable (``MAILER_API_TOKEN``). This fits pretty well with existing idiom, plus ensures that existing code using environment variables keeps working with no change.
47
-
48
- 4. You can load different credentials for different environments. For example: let's say you've bundled your credentials into ``myapp-dev`` and ``myapp-prod`` bundles (for development and production environments, respectively).
49
-
50
- In ``config/environments/development.rb``:
51
33
 
34
+ 3. Require the `voltos` gem early on, prior to where your trying to use any credentials
52
35
  ```ruby
53
- Voltos.configure do |config|
54
- config.api_key = ENV["VOLTOS_KEY"]
55
- end
56
-
57
- Voltos.load
58
- ENV["ANALYTICS_KEY"] = Voltos.key("myapp-dev", "ANALYTICS_KEY")
59
- ```
60
-
61
- Then in ``config/environments/production.rb``:
62
-
63
- ```ruby
64
- Voltos.configure do |config|
65
- config.api_key = ENV["VOLTOS_KEY"]
66
- end
67
-
68
- Voltos.load
69
- ENV["ANALYTICS_KEY"] = Voltos.key("myapp-prod", "ANALYTICS_KEY")
36
+ require 'voltos'
37
+ # access the credential "MAILER_API_TOKEN" that's in the bundle
38
+ puts ENV["MAILER_API_TOKEN"]
70
39
  ```
71
40
 
72
41
  ## Contributing
@@ -1,3 +1,3 @@
1
1
  module Voltos
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/voltos.rb CHANGED
@@ -58,7 +58,11 @@ module Voltos
58
58
 
59
59
  def initialize
60
60
  @api_url = ENV["VOLTOS_API_URL"] || "https://voltos.online/v1"
61
- @api_key = ""
61
+ @api_key = ENV["VOLTOS_API_KEY"]
62
62
  end
63
63
  end
64
64
  end
65
+
66
+ if ENV["VOLTOS_API_KEY"]
67
+ Voltos.load
68
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voltos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel May
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-06 00:00:00.000000000 Z
11
+ date: 2016-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler