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

Multiple databases support #10

Closed
ileitch opened this issue Feb 3, 2014 · 2 comments · May be fixed by #618
Closed

Multiple databases support #10

ileitch opened this issue Feb 3, 2014 · 2 comments · May be fixed by #618

Comments

@ileitch
Copy link
Member

ileitch commented Feb 3, 2014

Issue by sonxurxo from Thursday Nov 28, 2013 at 17:37 GMT
Originally opened as ileitch/rapns#183


Hi,

It would be nice if you could set somewhere the database to use by rapns.

I'm working on some projects and all of them are going to use rapns on the same machine, and my problem comes with the "only 1 instance of rapns" restriction.

My solution: I have a "master" rails app which I only use to configure and start rapns (daemon mode, e.g. "$ rapns production"). This app connects to the "rapns" database.

My other apps have their own database, and also access the rapns one. When I have to send a notification, I'm having to specify the rapns database connection with something like:

Rapns::App.establish_connection "rapns_#{Rails.env}"
Rapns::Notification.establish_connection "rapns_#{Rails.env}"

before creating the notification, to let ActiveRecord to find rapns classes.

So it would be great if you could specify somewhere the database configuration where rapns model objects live, in the initializer, for instance.

@ileitch
Copy link
Member Author

ileitch commented Feb 3, 2014

Comment by mattconnolly from Monday Jan 06, 2014 at 11:05 GMT


Could you make a simple API in your "master" app (the one with the rapns database) so the other apps simply make a HTTP request to it, and it's controller action is to save the notification so rapns can send it?

@ileitch
Copy link
Member Author

ileitch commented Feb 3, 2014

Comment by ileitch from Tuesday Jan 07, 2014 at 20:49 GMT


I'd accept a PR for this, but it's low priority for me personally.

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

Successfully merging a pull request may close this issue.

1 participant