go scratch code for atproto
1package main
2
3import (
4 "context"
5 "log/slog"
6 "os"
7
8 _ "github.com/joho/godotenv/autoload"
9
10 "github.com/earthboundkid/versioninfo/v2"
11 "github.com/urfave/cli/v3"
12)
13
14func main() {
15 if err := run(os.Args); err != nil {
16 slog.Error("fatal", "err", err)
17 os.Exit(-1)
18 }
19}
20
21func run(args []string) error {
22
23 app := cli.Command{
24 Name: "athome",
25 Usage: "public web interface to bluesky account content",
26 Version: versioninfo.Short(),
27 }
28
29 app.Commands = []*cli.Command{
30 &cli.Command{
31 Name: "serve",
32 Usage: "run the server",
33 Action: serve,
34 Flags: []cli.Flag{
35 &cli.StringFlag{
36 Name: "appview-host",
37 Usage: "method, hostname, and port of AppView instance",
38 Value: "https://api.bsky.app",
39 Sources: cli.EnvVars("ATP_APPVIEW_HOST"),
40 },
41 &cli.StringFlag{
42 Name: "bind",
43 Usage: "Specify the local IP/port to bind to",
44 Required: false,
45 Value: ":8200",
46 Sources: cli.EnvVars("ATHOME_BIND"),
47 },
48 &cli.BoolFlag{
49 Name: "debug",
50 Usage: "Enable debug mode",
51 Value: false,
52 Required: false,
53 Sources: cli.EnvVars("DEBUG"),
54 },
55 },
56 },
57 }
58
59 return app.Run(context.Background(), args)
60}