Files
claudeandClaude Sonnet 5 3eb0023efd
CI / go-tests (pull_request) Successful in 1m49s
Release / build-and-push (push) Skipped
Build / build-and-push (push) Successful in 1m14s
use the real module path
The module was code.aneur.in/cloud/ultrashorty but go.mod (and main.go's
internal import) still said gogs.home.aneur.in/go/ultrashorty, a host that
no longer exists. Self-consistent so it built, but wrong for anyone
fetching it and confusing to read.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-07 14:18:05 +01:00

37 lines
750 B
Go

package main
import (
"net"
"net/http"
"github.com/alecthomas/kong"
"github.com/rs/zerolog"
"code.aneur.in/cloud/ultrashorty/internal"
)
func main() {
cli := &internal.CLI{}
kong.Parse(cli, kong.Name("ultrashorty"), kong.Description("Really simple HTTP redirection using a CSV file."))
redirects, err := internal.ReadCsvRedirects(cli.File)
if err != nil {
panic(err)
}
srv := &internal.HttpServer{
CLI: cli,
Log: zerolog.New(zerolog.NewConsoleWriter()).With().Timestamp().Logger(),
Redirects: redirects,
}
addr := net.JoinHostPort(cli.Host, cli.Port)
errc := make(chan error)
go func() {
errc <- http.ListenAndServe(addr, srv)
}()
srv.Log.Info().Msgf("Listening at %s", addr)
err = <-errc
panic(err)
}