This commit is contained in:
2025-11-11 20:47:43 +01:00
parent 17a671a417
commit 1dbfe08225
9 changed files with 322 additions and 57 deletions

39
main.go
View File

@@ -1,15 +1,44 @@
package main
import app "go_oxspeak_server/app"
import (
"flag"
"log"
//TIP <p>To run your code, right-click the code and select <b>Run</b>.</p> <p>Alternatively, click
// the <icon src="AllIcons.Actions.Execute"/> icon in the gutter and select the <b>Run</b> menu item from here.</p>
"go_oxspeak_server/app"
"go_oxspeak_server/config"
)
func main() {
// Flag to specify the config file path
configPath := flag.String("config", "", "Path to configuration file (default: automatic search)")
flag.Parse()
// Load configuration
var cfg *config.Config
var err error
if *configPath != "" {
cfg, err = config.Load(*configPath)
} else {
// Automatic search
path, findErr := config.FindConfigFile()
if findErr != nil {
log.Fatalf("Error: %v", findErr)
}
log.Printf("Configuration file found: %s", path)
cfg, err = config.Load(path)
}
process := app.App{}
err := process.Run()
if err != nil {
log.Fatalf("Failed to load configuration: %v", err)
}
log.Printf("Configuration loaded - Database: %s", cfg.Database.Type)
// Start application
process := app.NewApp(cfg)
if err = process.Run(); err != nil {
log.Fatalf("Failed to start application: %v", err)
return
}
}