No commit activity in last 3 years
No release in over 3 years
Allow the rails portlet app to read and configure database with liferay portal-ext.properties
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.0.1
>= 2.0.1
 Project Readme

Liferay Database Config Reader¶ ↑

Setup¶ ↑

jgem install liferay_database_config_reader

Add the gem dependency in config/warble.rb

config.gems << 'liferay_database_config_reader'

Create a preinitializer.rb in config/ if you do not have one, after add the snippet below

if RUBY_PLATFORM =~ /java/ and ENV['RAILS_ENV'] == 'production'
  require 'rubygems'
  require 'liferay_database_config_reader'
  LiferayDatabaseConfigReader.init!
end

Change you config/database.yml

<% if RUBY_PLATFORM =~ /java/ and ENV['RAILS_ENV'] == 'production' %>               
production:
  adapter: <%= LiferayDatabaseConfigReader.attr[:adapter] %>
  database: <%= LiferayDatabaseConfigReader.attr[:database] %>
  username: <%= LiferayDatabaseConfigReader.attr[:username] %>
  password: <%= LiferayDatabaseConfigReader.attr[:password] %>
  encoding: unicode
  pool: 5
  timeout: 5000
<% end %>