create-t3-app icon indicating copy to clipboard operation
create-t3-app copied to clipboard

feat: able to rename '.env' with different file name

Open kchojhu opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe.

Problem: I'm currently using Cloud IDE (Git Pod) which utilizes Docker to setup the dev environment. Unfortunately, '.env' is also used in Docker environment as well and basically it somehow just ignores it. So when I run 'npm run dev', it gives error about various environment variables not being set.

Describe the solution you'd like to see

Suggestion: Not sure how exactly they set it up but my guess is that they don't want the users to muck with .env file and they suggest defining it on .gitpod.yml instead. However, that is a bit painful and I rather create a new file called maybe 't3.env' and have the app pointed to that.

Describe alternate solutions

If not above then would glad to hear about other solution.

Additional information

No response

kchojhu avatar Nov 28 '22 16:11 kchojhu

Your case seems too edgy to be included by default imo.

.env works for the large mass

juliusmarminge avatar Nov 29 '22 01:11 juliusmarminge

It's also quite annoying to use a file called anything other than .env with Prisma. We could include a note about it in the .env but I'm not if this is common enough to justify it.

c-ehrlich avatar Nov 29 '22 12:11 c-ehrlich

Yeah by default it should use '.env'. However, I can see a good use case for this if you have .env for production/development/etc... By all means I'm just starting to learning Next.js/Prisma/tRPC so maybe it already exists. It would be great if we could do this in package.json

"dev": "next dev -- --env .dev.env",

kchojhu avatar Nov 30 '22 16:11 kchojhu

Yeah by default it should use '.env'. However, I can see a good use case for this if you have .env for production/development/etc... By all means I'm just starting to learning Next.js/Prisma/tRPC so maybe it already exists. It would be great if we could do this in package.json

"dev": "next dev -- --env .dev.env",

You'd do something like this https://github.com/t3-oss/create-t3-turbo/blob/main/packages/db/package.json

juliusmarminge avatar Nov 30 '22 18:11 juliusmarminge

I think dotenv is the solution for this and we won't include it by default since .env will work for most. If you need something more you can easily install dotenv and make some wrapper command yourself:

https://github.com/t3-oss/create-t3-turbo/blob/20a00f1e2146a24ca3f47f7a9b2509356655abd7/packages/db/package.json#L9-L12

juliusmarminge avatar Dec 11 '22 12:12 juliusmarminge