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

Linking via an alias --alias forces the use of _URL as the environment variable suffix #234

Open
suwyn opened this issue Nov 30, 2023 · 1 comment

Comments

@suwyn
Copy link

suwyn commented Nov 30, 2023

Description of problem

When linking a postgres database to an app using the --link-flags argument, the plugin appends _URL to the environment variable name specified in the argument.

This causes an issue when the application you are linking does not use _URL as the suffix of the DSN URL. In our case that is Metabase, which uses MB_DB_CONNECTION_URI

Steps to Reproduce

  1. Create an application.
  2. Create a postgres database.
  3. Link the postgres database to the app by specifying an alias. dokku postgres:link metabase metabase -a MB_DB_CONNECTION_URI

Actual Results

Sets the environment variable MB_DB_CONNECTION_URI_URL on the metabase application

Expected Results

MB_DB_CONNECTION_URI would have been set.

The work around is to set the environment variable via the app config. e.g. dokku config:set metabase MB_DB_CONNECTION_URI=$(dokku postgres:info metabase --dsn)

@josegonzalez josegonzalez transferred this issue from dokku/dokku-postgres Feb 9, 2024
@josegonzalez
Copy link
Member

I'll post the potential fix here (from a discussion in discord):

TL;DR: We need a new flag called --env-name that tracks the alternative env-name. If set, we use that, otherwise, fallback to existing behavior.

That should make it generic enough that this is a copy-paste process for me to get this implemented on all datastores. You could implement the above on any datastore and I can take it from there, no need to focus on redis specifically.


This has been requested a few times and as I don't want to break existing behavior, I think the above is a good balance between desired functionality and backwards compatibility.

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

No branches or pull requests

2 participants