Guest User

Untitled

a guest
Jul 14th, 2018
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. Rails::Initializer.run do |config|
  2. config.action_controller.session = {
  3. :session_key => '_sector_hunter_session',
  4. :secret => 'f24a7eabb040c028a67a982efec0918efc67e2c304209ba1d7d17b074bb3154b946a4b09bf90f3a5950b8a7a3bfa6b84c75ad98d70366ccd48ad62debb2
  5. 319e6'
  6. }
  7.  
  8. class << config
  9. def database_configuration
  10. require 'json'
  11. ci_db_config = JSON.parse `php #{RAILS_ROOT}/../config_to_json.php database`
  12. active_group = ci_db_config['db'][ci_db_config['active_group']]
  13. super.merge!({ 'RAILS_ENV' => {
  14. :adapter => active_group['dbdriver'],
  15. :database => active_group['database'],
  16. :username => active_group['username'],
  17. :password => active_group['password'],
  18. :host => active_group['hostname'],
  19. :pool => 5
  20. }})
  21. end
  22. end
  23.  
  24. puts config.database_configuration.inspect
  25. end
Add Comment
Please, Sign In to add comment