codeword/template/cmd/{{.ProjectName}}/main.go.tmpl

29 lines
598 B
Cheetah
Raw Permalink Normal View History

2023-12-29 11:30:20 +00:00
package main
import (
"context"
"os/signal"
"syscall"
"{{.Vars.ProjectName}}/internal/app"
2024-03-03 20:18:42 +00:00
"{{.Modules.logger.Import}}"
"{{.Modules.logger.ImportCore}}"
2023-12-29 11:30:20 +00:00
2024-03-03 20:18:42 +00:00
"{{.Modules.env.Import}}"
2023-12-29 11:30:20 +00:00
)
func main() {
2024-03-03 20:18:42 +00:00
{{.Modules.logger.Declaration "logger"}}
2023-12-29 11:30:20 +00:00
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer cancel()
var config app.Config
{{.Modules.env.Declaration "config"}}
if err := app.Run(ctx, config, logger); err != nil {
{{.Modules.logger.Message "Fatal" "Failed to run app" "Error" "err"}}
}
2024-03-03 20:18:42 +00:00
}