RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.
MIT License
773 stars 69 forks source link

How to specify different .env variable for DATABASE_URL #143

Closed srapport closed 6 months ago

srapport commented 6 months ago

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

Fund with Polar

RobinBlomberg commented 6 months ago

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!