Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/heroku compatibility #64

Merged
merged 7 commits into from
Apr 15, 2014

Conversation

stansidel
Copy link

Added reading of ENV vars to the settings and a rake task to upload settings from the local files to Heroku. It works with nested settings, but not with arrays nor inline ruby expressions.
Refs #56

@pkuczynski pkuczynski added this to the 1.0 milestone Mar 31, 2014
@jacquescrocker
Copy link

this is rad. i want this feature! cc @pkuczynski wdyt?

@jacquescrocker
Copy link

@ssidelnikov sincere apologies I havent kept up on this

@thenano
Copy link

thenano commented Apr 14, 2014

Hi, any news on this? I'm trying to deploy to heroku and I have a Setting in yaml that uses erb to read from ENV. Is this the correct issue for my problem?

@jacquescrocker
Copy link

@thenano i believe ERB should work fine on heroku with the latest version. try it in master? please open an issue if it doesnt work, we'll try to fix asap

@thenano
Copy link

thenano commented Apr 15, 2014

Hi, I'm still getting the following error on heroku:

 rake aborted!
       (<unknown>): could not find expected ':' while scanning a simple key at line 7 column 1
       /tmp/build_f950fc9e-5256-4c47-99c6-d2cfc0317dd4/vendor/ruby-2.1.0/lib/ruby/2.1.0/psych.rb:369:in `parse'
       /tmp/build_f950fc9e-5256-4c47-99c6-d2cfc0317dd4/vendor/ruby-2.1.0/lib/ruby/2.1.0/psych.rb:369:in `parse_stream'
       /tmp/build_f950fc9e-5256-4c47-99c6-d2cfc0317dd4/vendor/ruby-2.1.0/lib/ruby/2.1.0/psych.rb:317:in `parse'
       /tmp/build_f950fc9e-5256-4c47-99c6-d2cfc0317dd4/vendor/ruby-2.1.0/lib/ruby/2.1.0/psych.rb:244:in `load'
       /tmp/build_f950fc9e-5256-4c47-99c6-d2cfc0317dd4/vendor/bundle/ruby/2.1.0/bundler/gems/rails_config-815c7c4c5524/lib/rails_config/sources/yaml_source.rb:17:in `load'
       /tmp/build_f950fc9e-5256-4c47-99c6-d2cfc0317dd4/vendor/bundle/ruby/2.1.0/bundler/gems/rails_config-815c7c4c5524/lib/rails_config/options.rb:23:in `block in reload!'
       /tmp/build_f950fc9e-5256-4c47-99c6-d2cfc0317dd4/vendor/bundle/ruby/2.1.0/bundler/gems/rails_config-815c7c4c5524/lib/rails_config/options.rb:22:in `each'
       /tmp/build_f950fc9e-5256-4c47-99c6-d2cfc0317dd4/vendor/bundle/ruby/2.1.0/bundler/gems/rails_config-815c7c4c5524/lib/rails_config/options.rb:22:in `reload!'
       /tmp/build_f950fc9e-5256-4c47-99c6-d2cfc0317dd4/vendor/bundle/ruby/2.1.0/bundler/gems/rails_config-815c7c4c5524/lib/rails_config.rb:30:in `load_files'
       /tmp/build_f950fc9e-5256-4c47-99c6-d2cfc0317dd4/vendor/bundle/ruby/2.1.0/bundler/gems/rails_config-815c7c4c5524/lib/rails_config.rb:37:in `load_and_set_settings'
       /tmp/build_f950fc9e-5256-4c47-99c6-d2cfc0317dd4/vendor/bundle/ruby/2.1.0/bundler/gems/rails_config-815c7c4c5524/lib/rails_config/integration/rails.rb:20:in `block in <class:Railtie>'

I'm using the master branch. Interestingly, I don't have any config files with 7 lines. Do you have any idea what's wrong? It could be an error on my part, this is how my config in heroku is:

api_private_key: <%= ENV['CHMS_USER_PRIVATE_KEY'] %>

@pkuczynski
Copy link
Member

Sorry, I was away on holiday. I will look into this today...

@thenano
Copy link

thenano commented Apr 15, 2014

Hi, I've investigated this more, and it's not that it cannot get the env variable, but the format of that variable. In development environment I have the following:

api_private_key: |
    -----BEGIN PGP PRIVATE KEY BLOCK-----
    Version: GnuPG v1

    lQHYBFM9FbQBBADPDZN0/RPw+Cu/S2xuYdOhO8sNAZJ9Nx15u4f2kkWA2Cs16hdG
    djuUKLi0keYG705dVZjxMDDVeYjB3tmA4Nx8ParBBdBqBqW7GbGzx8+dbKCH36V9
    FXg9tYhUGgSUXIKPfmGeV19ds7+J6pHVyaYFRRdK+ISItUL5KLt9yKaSdQARAQAB
    AAP9GDgsUXjxBjThWSUHb/n9eVS3MbRHYGI8DmtDQjJl8uZWV54kTtexrGj/AhA2
    6gTAE+bZVw0eCTqIJrVcl9i1sZTRp9ABcOmnBvIce4FBCsbl5lWmqgH98u65Mg89
    1oe4+bDVGmIb294foi+Y2ouSy9iZOcL7rWJ/uS8xV4QnQ8ECANvM2vTmevjNFnvI
    YeEjkmJYQK8BPZunVEJWMYXyCVvapANgFnPtdHVEKpxyup1DQxi0DrQGDcsPlYd7
    5Za1NCkCAPEnRzAP598Hk0fXGXlBHSROpgtoN3B3lb3ca1z5tI9EBiKvaEHPFOyd
    sPJAsirwPFmANaYGHXjS4/d0ZoV4FW0CAK21m+eU/nghULhMBNll8bKoyy6WEctM
    MgvjQ4fM+/fU+vjwagCszNeN4D202gvTZDhjZ+yBc7v/Sn68SFOn25GgNrQkTW9I
    IFVnYW5kYSA8YnVsYW11QHRob3VnaHR3b3Jrcy5jb20+iLgEEwECACIFAlM9FbQC
    GwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEAYtbvIXLK5tEn8EAKJB96mp
    4c3GxSh6ZOMESspajKCcPAGX2NcKHs0YgPxJpnNunICuVcDl1d2+fgtGQiIbhaWa
    eEKizpfEZ+escNtc1bCQXvZiMfweJ95YQsPQCYBBIk2hEd880gUy0bz0qoBMXiaH
    NxDW9xNOH37sA1crozAfLe9fk5D3hCFo8bar
    =XQO8
    -----END PGP PRIVATE KEY BLOCK-----

It's a multiline value. I have a similar looking key in the environment variable in heroku, and what I think is happening is that since the env variable doesn't have identation, yaml fails to parse. Any thoughts on how to address this?

@thenano
Copy link

thenano commented Apr 15, 2014

I've done some manipulation in the import of my env var. Essentially, doing this works for me:

<%= ENV['CHMS_USER_PRIVATE_KEY'].split("\n").each {|line| line.prepend('    ')}.join("\n") %>

Not the pretties thing, but works :)
Feel free to close the issue unless you think this needs to be handled within the gem.

@pkuczynski pkuczynski merged commit 1776f05 into rubyconfig:master Apr 15, 2014
@pkuczynski
Copy link
Member

@thenano I just merged this pull request. can you test in your env?

@railsjedi I do not use Heroku, so maybe you can have a look as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

4 participants