dokku-postgres
dokku-postgres copied to clipboard
Add exposed DSN option for postgres:info command
I love to use pgcli
on my laptop. I use it to log on my heroku databases (pgcli $(heroku config:get DATABASE_URL)
). And I would like to be able to do the same on dokku, so I created this PR.
I tested it on one dokku instance and it works correclty. And I'm able to do the following now.
$ pgcli $(ssh [email protected] postgres:info postgres-database --external-dsn)
I'm new in dokku usage, so I don't know all your conventions. Maybe this could not be done for some reason, or you want I do some changes. Let me know 🙂
$ ssh [email protected] config:get <app> DATABASE_URL
Must returns the same value as ssh [email protected] postgres:info postgres-database --dsn
does. In my case it returns the internal DSN. So it's not really the same.
Also I'm not sure about external-dsn
as flag name. Should it be exposed-dsn
or something else?
exposed-dsn
sounds fine.
I'll rename external-dsn
to exposed-dsn
so.
Hey josegonzalez. Are you still interested on this changes? I could found time in following weeks to end the work 🙂
Yes but I'd like this to be in the common-functions, so therefore generic so that we could do this to each database plugin.
The thing is like for service_url
(that is in functions
file too) we do not know the user that should be use to generate the URI.
- https://github.com/dokku/dokku-postgres/blob/89f080cb513336c3773f539e0ccc74802dbae954/functions#L159
- https://github.com/dokku/dokku-postgres/blob/3cb5b5940b10f8fb33104b6fa44af9291846f624/functions#L168
Do we need to have something like for redis plugin?
https://github.com/dokku/dokku-redis/blob/fb1b189aeac0411226f66e2099560fe2061601e9/functions#L158
Should I move both service_url
and service_exposed_url
inside common-functions
?
@nicolas-brousse do you mean hostname, not user?
A user
that is part of the hostname yes schema://user:password@host
.
The connection user (postgres
) is not currently contained in a variable.
Ah I see what you mean. In that case, ignore my comment.
Can you rebase this and provide the same PR to the other database plugins?
Yes sure.
But just to know, I noticed that for redis plugin, there is the variable $SERVICE
used. Do you think we could apply the same here?
https://github.com/dokku/dokku-redis/blob/fb1b189aeac0411226f66e2099560fe2061601e9/functions#L154-L159
Not sure thats always valid for all plugins.
Not sure either. I'll just rebase then, and do the same in other database plugins 🙂