Fix up options to be more better

This commit is contained in:
2025-10-10 20:52:57 +02:00
parent 6d88711576
commit a4ecb92123
2 changed files with 118 additions and 45 deletions

19
main.go
View File

@@ -6,9 +6,10 @@ import (
"os"
"os/signal"
logger "git.site.quack-lab.dev/dave/cylogger"
wh "go-eve-pi/webhook"
logger "git.site.quack-lab.dev/dave/cylogger"
"github.com/fasthttp/router"
"github.com/valyala/fasthttp"
)
@@ -16,7 +17,19 @@ import (
var webhook wh.Webhook
func main() {
// Add flag for generating .env.example
help := flag.Bool("help", false, "Generate .env.example file")
flag.Parse()
if *help {
if err := GenerateEnvExample(); err != nil {
logger.Error("Failed to generate .env.example: %v", err)
os.Exit(1)
}
logger.Info("Generated .env.example file successfully")
os.Exit(0)
}
logger.InitFlag()
logger.Info("Starting Eve PI")
@@ -30,8 +43,8 @@ func main() {
logger.Error("Failed to create SSO instance %v", err)
return
}
webhook = wh.NewZulipWebhook(options.ZulipURL, options.ZulipEmail, options.ZulipToken)
webhook = wh.NewZulipWebhook(options.WebhookURL, options.WebhookEmail, options.WebhookToken)
// Setup fasthttp router
r := router.New()