killbill / killbill-plugin-framework-ruby

Framework to write Kill Bill plugins in Ruby
http://killbill.io
8 stars 11 forks source link

expose a global constant that identifies running inside KB #39

Closed kares closed 9 years ago

kares commented 9 years ago

this could prove useful for plugins (despite the configuration .yml being used less), desired sample :

:stripe:
  :api_secret_key: <%= ENV['API_SECRET_KEY'] %>
  :api_publishable_key: <%= ENV['API_PUBLISHABLE_KEY'] %>
  :test: true

<% if defined? KILLBILL_VERSION %>
:database:
  :adapter: mariadb
  :jndi: 'killbill/osgi/jdbc'
  :pool: 100
<% else %>
:database:
  # ...
<% end %>

currently the following works but it's kind of a long and ugly hack (that is actually not supposed to work) : (Java::JavaClass.for_name('org.killbill.billing.osgi.bundles.jruby.JRubyPlugin') rescue false)

some viable alternatives to use :

depends on JRubyPlugin itself as it would need to expose the constant early-on while setting up the JRuby embed container.

... from https://github.com/killbill/killbill-plugin-framework-ruby/issues/37#issuecomment-94719888

kares commented 9 years ago

a simple draft : https://github.com/kares/killbill-platform/commit/6edf1251f75e95f999b5b5cc5671ccd574794741 defined? KILLBILL_PLATFORM_VERSION