heroku-config 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.gitignore +1 -0
 - data/CHANGELOG.md +3 -0
 - data/README.md +13 -0
 - data/lib/heroku_config/aws_key.rb +3 -2
 - data/lib/heroku_config/aws_key_name_map.rb +11 -0
 - data/lib/heroku_config/aws_rotate.rb +3 -2
 - data/lib/heroku_config/aws_rotate_all.rb +9 -3
 - data/lib/heroku_config/cli.rb +7 -0
 - data/lib/heroku_config/version.rb +1 -1
 - metadata +3 -3
 - data/Gemfile.lock +0 -86
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1c1f598d125e5ec01b4aca3b351bede098311ef847a6a428a53d21466a5f805e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 35ed5622a7474a5873820ac3c82af4ea3fe485fe22ead142b7a0383068427f4a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 32742182eeccae08d5984bf7ce0e65ac12a93e4e39a5b72a7dd158dd2a47397b250a0334f733ec25f61769c95eadf1f4e21b523df94a4b400312c6b52f56e5de
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a433cafaa1fba5d6f1ef25c2a4989d3eac1f68f52d41640cd3246f2a0a0381d5647fb70ed49b3fb5e4e7150fe8ca601e13be9c7e986b62b1fae500fda32a866e
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -3,6 +3,9 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            All notable changes to this project will be documented in this file.
         
     | 
| 
       4 
4 
     | 
    
         
             
            This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
      
 6 
     | 
    
         
            +
            ## [0.4.0]
         
     | 
| 
      
 7 
     | 
    
         
            +
            - support for custom aws key and secret heroku config var
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       6 
9 
     | 
    
         
             
            ## [0.3.0]
         
     | 
| 
       7 
10 
     | 
    
         
             
            - add aws-rotate-all command
         
     | 
| 
       8 
11 
     | 
    
         
             
            - friendly error if access key does not exist on heroku app
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -54,6 +54,19 @@ For more help: 
     | 
|
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         
             
                heroku-config aws-rotate-all -h
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
      
 57 
     | 
    
         
            +
            ## Custom Heroku Config Variable Names for AWS Key and Secret
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            Your app may not be using `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` for the heroku config vars. You can specify the config vars to use with the `--id-key-name` and `--secret-key-name` options. Example:
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                heroku-config aws-rotate protected-oasis-24054 --id-key-name AWS_KEY --secret-key-name AWS_SECRET
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            For the `heroku-config aws-rotate-all` command, use a `:` to separate the app, id key name, and secret key name for the FILE format. Example:
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                radiant-fortress-40674
         
     | 
| 
      
 66 
     | 
    
         
            +
                protected-oasis-24054:aws_key:aws_secret
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            Here `radiant-fortress-40674` will use the default `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`, whereas `protected-oasis-24054` will use `aws_key` and `aws_secret`.
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
       57 
70 
     | 
    
         
             
            ## Installation
         
     | 
| 
       58 
71 
     | 
    
         | 
| 
       59 
72 
     | 
    
         
             
            Install with:
         
     | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module HerokuConfig
         
     | 
| 
       2 
2 
     | 
    
         
             
              class AwsKey < Base
         
     | 
| 
       3 
3 
     | 
    
         
             
                include AwsServices
         
     | 
| 
      
 4 
     | 
    
         
            +
                include AwsKeyNameMap
         
     | 
| 
       4 
5 
     | 
    
         
             
                class MaxKeysError < StandardError; end
         
     | 
| 
       5 
6 
     | 
    
         
             
                class AccessKeyNotFound < StandardError; end
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
         @@ -83,8 +84,8 @@ module HerokuConfig 
     | 
|
| 
       83 
84 
     | 
    
         | 
| 
       84 
85 
     | 
    
         
             
                def update_heroku_config(new_key, new_secret)
         
     | 
| 
       85 
86 
     | 
    
         
             
                  out = config.set(
         
     | 
| 
       86 
     | 
    
         
            -
                     
     | 
| 
       87 
     | 
    
         
            -
                     
     | 
| 
      
 87 
     | 
    
         
            +
                    id_key_name => new_key,
         
     | 
| 
      
 88 
     | 
    
         
            +
                    secret_key_name => new_secret,
         
     | 
| 
       88 
89 
     | 
    
         
             
                  )
         
     | 
| 
       89 
90 
     | 
    
         
             
                  puts "Setting heroku config variables"
         
     | 
| 
       90 
91 
     | 
    
         
             
                  puts out
         
     | 
| 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module HerokuConfig
         
     | 
| 
       2 
2 
     | 
    
         
             
              class AwsRotate < Base
         
     | 
| 
      
 3 
     | 
    
         
            +
                include AwsKeyNameMap
         
     | 
| 
       3 
4 
     | 
    
         
             
                class MaxKeysError < StandardError; end
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
                def initialize(options={})
         
     | 
| 
         @@ -8,9 +9,9 @@ module HerokuConfig 
     | 
|
| 
       8 
9 
     | 
    
         
             
                end
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
       10 
11 
     | 
    
         
             
                def run
         
     | 
| 
       11 
     | 
    
         
            -
                  key_id = config.get( 
     | 
| 
      
 12 
     | 
    
         
            +
                  key_id = config.get(id_key_name)
         
     | 
| 
       12 
13 
     | 
    
         
             
                  unless key_id
         
     | 
| 
       13 
     | 
    
         
            -
                    puts "WARN: No  
     | 
| 
      
 14 
     | 
    
         
            +
                    puts "WARN: No #{id_key_name} found for #{@app.color(:green)} app."
         
     | 
| 
       14 
15 
     | 
    
         
             
                    if @options[:cli]
         
     | 
| 
       15 
16 
     | 
    
         
             
                      puts "Exiting"
         
     | 
| 
       16 
17 
     | 
    
         
             
                      exit 0
         
     | 
| 
         @@ -11,13 +11,19 @@ module HerokuConfig 
     | 
|
| 
       11 
11 
     | 
    
         
             
                    return
         
     | 
| 
       12 
12 
     | 
    
         
             
                  end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                  apps.each do |app|
         
     | 
| 
       15 
     | 
    
         
            -
                     
     | 
| 
      
 14 
     | 
    
         
            +
                  apps.each do |app, id_key_name, secret_key_name|
         
     | 
| 
      
 15 
     | 
    
         
            +
                    options = @options.merge(
         
     | 
| 
      
 16 
     | 
    
         
            +
                      app: app,
         
     | 
| 
      
 17 
     | 
    
         
            +
                      id_key_name: id_key_name || 'AWS_ACCESS_KEY_ID',
         
     | 
| 
      
 18 
     | 
    
         
            +
                      secret_key_name: secret_key_name || 'AWS_SECRET_ACCESS_KEY',
         
     | 
| 
      
 19 
     | 
    
         
            +
                    )
         
     | 
| 
      
 20 
     | 
    
         
            +
                    AwsRotate.new(options).run
         
     | 
| 
       16 
21 
     | 
    
         
             
                  end
         
     | 
| 
       17 
22 
     | 
    
         
             
                end
         
     | 
| 
       18 
23 
     | 
    
         | 
| 
       19 
24 
     | 
    
         
             
                def apps
         
     | 
| 
       20 
     | 
    
         
            -
                  IO.readlines(@file).map(&:strip).reject(&:empty?)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  lines = IO.readlines(@file).map(&:strip).reject(&:empty?)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  lines.map { |l| l.split(':') }
         
     | 
| 
       21 
27 
     | 
    
         
             
                end
         
     | 
| 
       22 
28 
     | 
    
         
             
                memoize :apps
         
     | 
| 
       23 
29 
     | 
    
         
             
              end
         
     | 
    
        data/lib/heroku_config/cli.rb
    CHANGED
    
    | 
         @@ -3,14 +3,21 @@ module HerokuConfig 
     | 
|
| 
       3 
3 
     | 
    
         
             
                class_option :verbose, type: :boolean
         
     | 
| 
       4 
4 
     | 
    
         
             
                class_option :noop, type: :boolean
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
      
 6 
     | 
    
         
            +
                key_name_options = Proc.new do
         
     | 
| 
      
 7 
     | 
    
         
            +
                  option :id_key_name, default: "AWS_ACCESS_KEY_ID", desc: "Heroku config variable name for AWS_ACCESS_KEY_ID"
         
     | 
| 
      
 8 
     | 
    
         
            +
                  option :secret_key_name, default: "AWS_SECRET_ACCESS_KEY", desc: "Heroku config variable name for AWS_SECRET_ACCESS_KEY"
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       6 
11 
     | 
    
         
             
                desc "aws-rotate APP", "Rotates AWS key for app"
         
     | 
| 
       7 
12 
     | 
    
         
             
                long_desc Help.text(:aws_rotate)
         
     | 
| 
      
 13 
     | 
    
         
            +
                key_name_options.call
         
     | 
| 
       8 
14 
     | 
    
         
             
                def aws_rotate(app)
         
     | 
| 
       9 
15 
     | 
    
         
             
                  AwsRotate.new(options.merge(app: app, cli: true)).run
         
     | 
| 
       10 
16 
     | 
    
         
             
                end
         
     | 
| 
       11 
17 
     | 
    
         | 
| 
       12 
18 
     | 
    
         
             
                desc "aws-rotate-all FILE", "Rotates AWS key for list of apps"
         
     | 
| 
       13 
19 
     | 
    
         
             
                long_desc Help.text(:aws_rotate_all)
         
     | 
| 
      
 20 
     | 
    
         
            +
                key_name_options.call
         
     | 
| 
       14 
21 
     | 
    
         
             
                def aws_rotate_all(file)
         
     | 
| 
       15 
22 
     | 
    
         
             
                  AwsRotateAll.new(options.merge(file: file)).run
         
     | 
| 
       16 
23 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: heroku-config
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Tung Nguyen
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2019-11- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-11-18 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -190,7 +190,6 @@ files: 
     | 
|
| 
       190 
190 
     | 
    
         
             
            - ".rspec"
         
     | 
| 
       191 
191 
     | 
    
         
             
            - CHANGELOG.md
         
     | 
| 
       192 
192 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       193 
     | 
    
         
            -
            - Gemfile.lock
         
     | 
| 
       194 
193 
     | 
    
         
             
            - Guardfile
         
     | 
| 
       195 
194 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       196 
195 
     | 
    
         
             
            - README.md
         
     | 
| 
         @@ -201,6 +200,7 @@ files: 
     | 
|
| 
       201 
200 
     | 
    
         
             
            - lib/heroku_config.rb
         
     | 
| 
       202 
201 
     | 
    
         
             
            - lib/heroku_config/autoloader.rb
         
     | 
| 
       203 
202 
     | 
    
         
             
            - lib/heroku_config/aws_key.rb
         
     | 
| 
      
 203 
     | 
    
         
            +
            - lib/heroku_config/aws_key_name_map.rb
         
     | 
| 
       204 
204 
     | 
    
         
             
            - lib/heroku_config/aws_rotate.rb
         
     | 
| 
       205 
205 
     | 
    
         
             
            - lib/heroku_config/aws_rotate_all.rb
         
     | 
| 
       206 
206 
     | 
    
         
             
            - lib/heroku_config/aws_services.rb
         
     | 
    
        data/Gemfile.lock
    DELETED
    
    | 
         @@ -1,86 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            PATH
         
     | 
| 
       2 
     | 
    
         
            -
              remote: .
         
     | 
| 
       3 
     | 
    
         
            -
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                heroku-config (0.2.0)
         
     | 
| 
       5 
     | 
    
         
            -
                  activesupport
         
     | 
| 
       6 
     | 
    
         
            -
                  aws-sdk-core
         
     | 
| 
       7 
     | 
    
         
            -
                  aws-sdk-iam
         
     | 
| 
       8 
     | 
    
         
            -
                  memoist
         
     | 
| 
       9 
     | 
    
         
            -
                  rainbow
         
     | 
| 
       10 
     | 
    
         
            -
                  thor
         
     | 
| 
       11 
     | 
    
         
            -
                  zeitwerk
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            GEM
         
     | 
| 
       14 
     | 
    
         
            -
              remote: https://rubygems.org/
         
     | 
| 
       15 
     | 
    
         
            -
              specs:
         
     | 
| 
       16 
     | 
    
         
            -
                activesupport (6.0.1)
         
     | 
| 
       17 
     | 
    
         
            -
                  concurrent-ruby (~> 1.0, >= 1.0.2)
         
     | 
| 
       18 
     | 
    
         
            -
                  i18n (>= 0.7, < 2)
         
     | 
| 
       19 
     | 
    
         
            -
                  minitest (~> 5.1)
         
     | 
| 
       20 
     | 
    
         
            -
                  tzinfo (~> 1.1)
         
     | 
| 
       21 
     | 
    
         
            -
                  zeitwerk (~> 2.2)
         
     | 
| 
       22 
     | 
    
         
            -
                aws-eventstream (1.0.3)
         
     | 
| 
       23 
     | 
    
         
            -
                aws-partitions (1.240.0)
         
     | 
| 
       24 
     | 
    
         
            -
                aws-sdk-core (3.78.0)
         
     | 
| 
       25 
     | 
    
         
            -
                  aws-eventstream (~> 1.0, >= 1.0.2)
         
     | 
| 
       26 
     | 
    
         
            -
                  aws-partitions (~> 1, >= 1.239.0)
         
     | 
| 
       27 
     | 
    
         
            -
                  aws-sigv4 (~> 1.1)
         
     | 
| 
       28 
     | 
    
         
            -
                  jmespath (~> 1.0)
         
     | 
| 
       29 
     | 
    
         
            -
                aws-sdk-iam (1.31.0)
         
     | 
| 
       30 
     | 
    
         
            -
                  aws-sdk-core (~> 3, >= 3.71.0)
         
     | 
| 
       31 
     | 
    
         
            -
                  aws-sigv4 (~> 1.1)
         
     | 
| 
       32 
     | 
    
         
            -
                aws-sigv4 (1.1.0)
         
     | 
| 
       33 
     | 
    
         
            -
                  aws-eventstream (~> 1.0, >= 1.0.2)
         
     | 
| 
       34 
     | 
    
         
            -
                byebug (11.0.1)
         
     | 
| 
       35 
     | 
    
         
            -
                cli_markdown (0.1.0)
         
     | 
| 
       36 
     | 
    
         
            -
                codeclimate-test-reporter (1.0.9)
         
     | 
| 
       37 
     | 
    
         
            -
                  simplecov (<= 0.13)
         
     | 
| 
       38 
     | 
    
         
            -
                concurrent-ruby (1.1.5)
         
     | 
| 
       39 
     | 
    
         
            -
                diff-lcs (1.3)
         
     | 
| 
       40 
     | 
    
         
            -
                docile (1.1.5)
         
     | 
| 
       41 
     | 
    
         
            -
                i18n (1.7.0)
         
     | 
| 
       42 
     | 
    
         
            -
                  concurrent-ruby (~> 1.0)
         
     | 
| 
       43 
     | 
    
         
            -
                jmespath (1.4.0)
         
     | 
| 
       44 
     | 
    
         
            -
                json (2.2.0)
         
     | 
| 
       45 
     | 
    
         
            -
                memoist (0.16.1)
         
     | 
| 
       46 
     | 
    
         
            -
                minitest (5.13.0)
         
     | 
| 
       47 
     | 
    
         
            -
                rainbow (3.0.0)
         
     | 
| 
       48 
     | 
    
         
            -
                rake (13.0.1)
         
     | 
| 
       49 
     | 
    
         
            -
                rspec (3.9.0)
         
     | 
| 
       50 
     | 
    
         
            -
                  rspec-core (~> 3.9.0)
         
     | 
| 
       51 
     | 
    
         
            -
                  rspec-expectations (~> 3.9.0)
         
     | 
| 
       52 
     | 
    
         
            -
                  rspec-mocks (~> 3.9.0)
         
     | 
| 
       53 
     | 
    
         
            -
                rspec-core (3.9.0)
         
     | 
| 
       54 
     | 
    
         
            -
                  rspec-support (~> 3.9.0)
         
     | 
| 
       55 
     | 
    
         
            -
                rspec-expectations (3.9.0)
         
     | 
| 
       56 
     | 
    
         
            -
                  diff-lcs (>= 1.2.0, < 2.0)
         
     | 
| 
       57 
     | 
    
         
            -
                  rspec-support (~> 3.9.0)
         
     | 
| 
       58 
     | 
    
         
            -
                rspec-mocks (3.9.0)
         
     | 
| 
       59 
     | 
    
         
            -
                  diff-lcs (>= 1.2.0, < 2.0)
         
     | 
| 
       60 
     | 
    
         
            -
                  rspec-support (~> 3.9.0)
         
     | 
| 
       61 
     | 
    
         
            -
                rspec-support (3.9.0)
         
     | 
| 
       62 
     | 
    
         
            -
                simplecov (0.13.0)
         
     | 
| 
       63 
     | 
    
         
            -
                  docile (~> 1.1.0)
         
     | 
| 
       64 
     | 
    
         
            -
                  json (>= 1.8, < 3)
         
     | 
| 
       65 
     | 
    
         
            -
                  simplecov-html (~> 0.10.0)
         
     | 
| 
       66 
     | 
    
         
            -
                simplecov-html (0.10.2)
         
     | 
| 
       67 
     | 
    
         
            -
                thor (0.20.3)
         
     | 
| 
       68 
     | 
    
         
            -
                thread_safe (0.3.6)
         
     | 
| 
       69 
     | 
    
         
            -
                tzinfo (1.2.5)
         
     | 
| 
       70 
     | 
    
         
            -
                  thread_safe (~> 0.1)
         
     | 
| 
       71 
     | 
    
         
            -
                zeitwerk (2.2.1)
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
            PLATFORMS
         
     | 
| 
       74 
     | 
    
         
            -
              ruby
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
            DEPENDENCIES
         
     | 
| 
       77 
     | 
    
         
            -
              bundler
         
     | 
| 
       78 
     | 
    
         
            -
              byebug
         
     | 
| 
       79 
     | 
    
         
            -
              cli_markdown
         
     | 
| 
       80 
     | 
    
         
            -
              codeclimate-test-reporter
         
     | 
| 
       81 
     | 
    
         
            -
              heroku-config!
         
     | 
| 
       82 
     | 
    
         
            -
              rake
         
     | 
| 
       83 
     | 
    
         
            -
              rspec
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
            BUNDLED WITH
         
     | 
| 
       86 
     | 
    
         
            -
               2.0.2
         
     |