package main import ( "flag" "fmt" "log/slog" "net/http" "os" "git.runcible.io/learning/ratchet/internal/logging" "git.runcible.io/learning/ratchet/internal/server" // "git.runcible.io/learning/ratchet" // ratchethttp "git.runcible.io/learning/ratchet/internal" ) // var ( // version string // commit string // ) func main() { // CONFIGURATION // Parse command line options addr := flag.String("addr", "0.0.0.0", "HTTP network address") port := flag.String("port", "5001", "HTTP port") logLevel := flag.String("logging", "INFO", "Logging Level. Valid values [INFO, DEBUG, WARN, ERROR].") // must call parse or all values will be the defaults flag.Parse() // DEPENDENCY INJECTION FOR HANDLERS // Setup Logging logger := logging.InitLogging(*logLevel) // Propagate build information to root package to share globally // ratchet.Version = strings.TrimPrefix(version, "") // ratchet.Commit = commit server := server.NewRatchetServer(logger) // START SERVING REQUESTS slog.Debug("Herp dirp!") slog.Info(fmt.Sprintf("Listening on http://%s:%s", *addr, *port)) //log.Fatal(http.ListenAndServe(fmt.Sprintf("%s:%s", *addr, *port), server)) // there is no log.Fatal equivalent. This is an approximation of the behavior err := http.ListenAndServe(fmt.Sprintf("%s:%s", *addr, *port), server) slog.Error(err.Error()) os.Exit(1) }