Closed MitchellBerend closed 9 months ago
This is a good idea. If you want, you can do it. I am just interested in how you would implement that. Would it be similar to .env injections or another approach?
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)
}
I can't rly work on anything for a while actually.
We'll leave it open, perhaps someone else will take care of it, or when you have time, you can tackle this one.
Tell us about your feature request
While working on #174 I noticed that the database and non database templates for all frameworks are very similar. I would like to combine all these files and add if conditions in the template itself to check if the database endpoint and dependencies are required or not. This would also make it easier to add a conditional websocket endpoint in the same file.
I'm using the chi files as an example here but the others are also very similar
Disclaimer