package main import ( "context" "errors" "go.sour.is/xt/internal/console" "go.sour.is/xt/internal/env" "go.sour.is/xt/internal/otel" ) const name = "go.sour.is/xt" type args struct { dbtype string dbfile string baseFeed string Nick string URI string Listen string Hostname string } func main() { env.DotEnv() // load .env ctx, console := console.New(args{ dbtype: env.Default("XT_DBTYPE", "sqlite3"), dbfile: env.Default("XT_DBFILE", "file:twt.db"), baseFeed: env.Default("XT_BASE_FEED", ""), Nick: env.Default("XT_NICK", "xuu"), URI: env.Default("XT_URI", "https://txt.sour.is/user/xuu/twtxt.txt"), Listen: env.Default("XT_LISTEN", ":8080"), Hostname: env.Default("XT_HOSTNAME", "https://watcher.sour.is"), }) finish, err := otel.Init(ctx, name) console.IfFatal(err) console.AddCancel(finish) m_up, err := otel.Meter().Int64Gauge("up") console.IfFatal(err) m_up.Record(ctx, 1) defer m_up.Record(context.Background(), 0) err = run(ctx, console) if !errors.Is(err, context.Canceled) { console.IfFatal(err) } }