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

How to specify different .env variable for DATABASE_URL #143

Closed
srapport opened this issue Mar 28, 2024 · 3 comments
Closed

How to specify different .env variable for DATABASE_URL #143

srapport opened this issue Mar 28, 2024 · 3 comments

Comments

@srapport
Copy link

srapport commented Mar 28, 2024

We have multiple databases in the same project that have different connection strings. Is there a way to specify the .env variable to use in the kysely-codegen command line?

For example:

kysely-codegen --env-var CORE_PRODUCT_DB_URL ...
kysely-codegen --env-var LICENSING_DB_URL ...

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@RobinBlomberg
Copy link
Owner

Hey!

You can use kysely-codegen --url=env(CORE_PRODUCT_DB_URL). 😊

If you need to specify the environment file, you can use --env-file as well.

Hope that helps!

@srapport
Copy link
Author

Hi @RobinBlomberg,

I wanted to circle back on this as --url=env(VAR_NAME) never worked and I see a related open issue #168. This is a really important feature of the command line inputs.

WORKAROUND: The only workaround I could find (and currently use) has been a whole stack of .env.database_name files containing a single DATABASE_URL, then a stack of package scripts for each passing --env-file .env.database_name.

As projects grow, anybody touching a project must have a whole stack of env files.

Is this a bug, bad docs, or pilot error not knowing the right syntax?

Thank you.

@DeryGaleas
Copy link

Any update on this issue?

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

No branches or pull requests

3 participants