[Feature Request] Remove .env and add .env to .gitignore
Closed this issue · 1 comments
Melkeydev commented
Tell us about your feature request
Since we are adding .env.example we no longer need a .env file and additionally we should include this as one of the files to ignore
Disclaimer
- I agree
Ujstor commented
I don't think it's a good idea to remove .env file completely. It is a two-part file, created from globalenv.tmpl and a specific DB template. Maybe we can remove the DB-specific variables. If we keep the current configuration, that's good, or alternatively, we could remove the .env.example and bind default variables in .env so that Docker Compose works out of the box.
What do you think is the best approach?
#global
PORT=8080
APP_ENV=local
#DB specific
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
DB_ROOT_PASSWORD=
This is core logic for .env
case "env":
if p.DBDriver != "none" {
envBytes := [][]byte{
tpl.GlobalEnvTemplate(),
p.DBDriverMap[p.DBDriver].templater.Env(),
}
createdTemplate := template.Must(template.New(fileName).Parse(string(bytes.Join(envBytes, []byte("\n")))))
err = createdTemplate.Execute(createdFile, p)
} else {
createdTemplate := template.Must(template.New(fileName).Parse(string(tpl.GlobalEnvTemplate())))
err = createdTemplate.Execute(createdFile, p)
}