You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I am attempting to set up branch previews (similar to Vercel) in railway. To do this, I need to update some environment variables on the railway side, including SUPABASE_DB_URL.
Describe the solution you'd like
I'd like to be able to run some supabase CLI command to obtain the DB_URl automatically, so I don't have to add it manually as a variable whenever I make a new branch. However, I cannot find a CLI command that will do this. gen keys gives me the password but not the user, the port, the database, or the host. branches get has the user, port, and host, but these conflict with the information shown in my dashboard. (I assume the database is always postgres?)
Describe alternatives you've considered
I've looked in the docs for the CLI and the javascript library, and neither of them seems to provide the database url. Any help is appreciated!
We can definitely make branches get more useful by adding a --output env flag to format the output. We already have a list of envs that users typically want exposed. These include both pooling (shown in cli) and non-pooling (shown on dashboard) db urls.
I will probably have time to look into this early 2025.
@sweatybridge , if this issue is open, then may I work on this issue? I've a lot of experience in Go and have previously contributed to Keploy, Meshery(both CNCF projects) and Taipy.
May I work on this issue, if it's open to all 👀 ?
Thanks for your suggestions @sweatybridge!
I've a few doubts, regarding the same, could you please help me with those:
Firstly, what exactly we're doing here is that, currently there's no command to export the supabase DB_URL from the .env file and we need to add a flag --output env to the existing command - branches get?
As mentioned by you in this comment, the one's with pooling are shown in cli and ones with non_pooling, are shown on the supabase dashboard. So, I need to export this - POSTGRES_URL = "POSTGRES_URL", to the cli, am I right? Is there anything else also that needs to be exported?
And yes, I'll take help from the status command to check how to add a new flag to a command, which you mentioned in your previous comment 👍
Currently branches get command prints the database connection details, but not the full connection string. The code for building the full connection string is available in bootstrap command. Also in the bootstrap command, we expose both pooling and non pooling url.
So there are a few tasks I would suggest as next steps
Add --output flag to branches get command while keeping all existing output fields. For eg, the current table output includes db user field, so specifying --output env should also include a POSTGRES_USER env var.
Next, we can add postgres_url and postgres_url_non_pooling to the env output. The code for this can be reused from bootstrap command.
Activity
sweatybridge commentedon Dec 11, 2024
Hi @Innoviox, thanks for the suggestion.
We can definitely make
branches getmore useful by adding a--output envflag to format the output. We already have a list of envs that users typically want exposed. These include both pooling (shown in cli) and non-pooling (shown on dashboard) db urls.I will probably have time to look into this early 2025.
yaten2302 commentedon Dec 20, 2024
@sweatybridge , if this issue is open, then may I work on this issue? I've a lot of experience in Go and have previously contributed to Keploy, Meshery(both CNCF projects) and Taipy.
May I work on this issue, if it's open to all 👀 ?
sweatybridge commentedon Dec 20, 2024
@yaten2302 sure thing. We have some examples of using the output flag in status command.
Feel free to tag me if you have any questions or want a review.
yaten2302 commentedon Dec 20, 2024
Thanks for your suggestions @sweatybridge!
I've a few doubts, regarding the same, could you please help me with those:
.envfile and we need to add a flag--output envto the existing command -branches get?POSTGRES_URL = "POSTGRES_URL", to the cli, am I right? Is there anything else also that needs to be exported?And yes, I'll take help from the status command to check how to add a new flag to a command, which you mentioned in your previous comment 👍
yaten2302 commentedon Dec 24, 2024
Any update on this @sweatybridge :)
sweatybridge commentedon Dec 24, 2024
Currently
branches getcommand prints the database connection details, but not the full connection string. The code for building the full connection string is available in bootstrap command. Also in the bootstrap command, we expose both pooling and non pooling url.So there are a few tasks I would suggest as next steps
Add
--outputflag to branches get command while keeping all existing output fields. For eg, the current table output includes db user field, so specifying--output envshould also include aPOSTGRES_USERenv var.Next, we can add postgres_url and postgres_url_non_pooling to the env output. The code for this can be reused from bootstrap command.
Hope it clarifies.
yaten2302 commentedon Dec 25, 2024
Got it @sweatybridge 👍
I've understood the workflow, working on it, I'll create a draft PR soon!!
Thanks
yaten2302 commentedon Dec 25, 2024
@sweatybridge I've created a draft PR for this issue 👍
yaten2302 commentedon Dec 29, 2024
Hey @sweatybridge , could you please guide regarding the PR, whenever you get time :)
Thanks