database.yml file is not evaluated with ERB before being parsed by YAML
-----------------------------------------------------------------------

                 Key: JRUBY-3421
                 URL: http://jira.codehaus.org/browse/JRUBY-3421
             Project: JRuby
          Issue Type: Bug
          Components: ActiveRecord-JDBC
    Affects Versions: JRuby 1.1.6
         Environment: Ubuntu 8 and OSX 10.5, JRuby 1.1.6
            Reporter: David Koontz


In my database.yml file I have some ERB to set up the production user and 
password.  These are never evaluated and cause a YAML parse error

syntax error:ParserException while scanning a block mapping we had this 
expected <block end>, but found org.jvyamlb.tokens.ScalarToken (ArgumentError)

I have verified the non-evaluation of the ERB is happening by commenting out 
the ERB that is standalone on a line and left only the ERB that's part of a 
key-value pair.

username: <%= user %>

This will pass a YAML parse but the value of the username key is "<%= user %>"

Below is my full database.yml file.

development:
  adapter: jdbcmysql
  encoding: utf8
  database: reporting
  username: root
  password:
  host: localhost

test:
  adapter: sqlite3
  database: db/test.sqlite3
  timeout: 5000

<%
    db_settings = 
YAML::load(File.open('/jumpbox/lib/appdata.yml'))['mysql']['users']
    user = db_settings.keys.first
    password = db_settings[user]
%>

production:
  adapter: jdbcmysql
  encoding: utf8
  database: reporting
  username: <%= user %>
  password: <%= password %>
  host: localhost

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to