Closed ghost closed 8 years ago
You're right there is no explicit option to do this. But you can code around this using the url
parameter. I am using somehting like this in our code
def self.create_connection_pool(env)
cert_path = path_to_certfile(env)
url = development_env?(env) ? Apnotic::APPLE_DEVELOPMENT_SERVER_URL : nil
Apnotic::ConnectionPool.new({
url: url,
cert_path: cert_path,
}, size: 5)
end
where env
is our own internal environment name(s).
Yes, that's how I'm using right now and it works fine but the code would be so much cleaner and resource usage efficient if I could use the connection pool for the same.
Currently, I'm doing it like below:
def get_apn_connection
Rails.env.development? ? Apnotic::Connection.development(cert_path: APNS.pem) : Apnotic::Connection.new(cert_path: APNS.pem)
end
This is now developed, will be included in the 1.1.0
release.
Thank you for your input.
Currently the ConnectionPool returns only the
PRODUCTION
objects of Apnotic::Connection. There's no option to return development objects in case someone wants to use the connection pool with development objects.