Replies: 1 comment 1 reply
-
|
Hey @serggiu.
You can make that work by adding this single line to your application config: ActiveRecord.protocol_adapters[:postgresqlproxy] = 'postgresql_proxy'I have thought about adding that to gem by default but, the reason I haven't done so yet, is because that would mislead users into thinking
That option won't work because
PRs are welcome :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This has been flagged in another issue but wasn't pursued because the author did not provide enough info.
When the database connection is configured using the
DATABASE_URLENV var, we cannot overwrite theadapteroption by simply mentioning it in thedatabase.yml.In this case, the logic to extract the connection details is coming from
ActiveRecord::DatabaseConfigurations::UrlConfigwhich doesn't use any other options given indatabase.yml.Trying to overwrite the
protocolpart fromDATABASE_URL, something like:will not work because
postgresql_proxyis not considered valid inside the URL, especially at the protocol level.I can see two options here, but please let me know if you see any other:
Option 1: along with
postgresql_proxy, also allowpostgresqlproxy(one word, no_char which is considered invalid char in a URL) to trigger the switch to the proxy adapter.Option 2: update the Readme with an alternative option to switch to the proxy adapter, maybe in an initializer, something like this:
The workaround I'm using now is derived from your suggestion in Issue 136. I've updated the
database.ymllike this:The empty
url:part is needed to overwrite the usage of theDATABASE_URLENV var. It does work but it's not the most elegant solution.I think that updating the gem documentation with an option for this situation would offer a solution to those using Heroku or other similar platforms.
Please let me know your thoughts on this, thank you!
Beta Was this translation helpful? Give feedback.
All reactions