Melkeydev / go-blueprint

Go-blueprint allows users to spin up a quick Go project using a popular framework
https://docs.go-blueprint.dev/
MIT License
5.49k stars 318 forks source link

[Feature Request] prevent environment variables clash. #290

Closed spankie closed 1 month ago

spankie commented 3 months ago

Tell us about your feature request

Right now the default environment variables are generic e.g. DB_HOST, which can be used by other applications running locally. This can cause clashes by overwriting previous environment variables that already exist. My suggestion is to prefix the default environment variables with the name of the app created. For example, if I create an app with the name some-app the environment variables would be prefixed with a sanitized name of the app (SOME_APP) like this: SOME_APP_DB_HOST

Disclaimer

H0llyW00dzZ commented 3 months ago

Tell us about your feature request

Right now the default environment variables are generic e.g. DB_HOST, which can be used by other applications running locally. This can cause clashes by overwriting previous environment variables that already exist. My suggestion is to prefix the default environment variables with the name of the app created. For example, if I create an app with the name some-app the environment variables would be prefixed with a sanitized name of the app (SOME_APP) like this: SOME_APP_DB_HOST

Disclaimer

  • [x] I agree

Having known this, I think it would be better to use BLUEPRINT_DB_HOST or BP_DB_HOST as the prefix for the environment variables.

spankie commented 3 months ago

Okay, but this would involve the user having to change it again which they can do initially without the BLUEPRINT_ prefix. And if other projects are created their environment variables will all have the same prefix.

I understand that godotenv does not persist the environment variables, but it would be better to have these prefixed with the name of the app.

Ujstor commented 3 months ago

We can change the variable names, and the PR will be accepted if someone implements this.