bsky-app/bskyweb/cmd/bskyweb/main.go
bnewbold a115c17a09
bskyweb: switch from PDS backend to AppView backend (#1065)
* bskyweb: replace PDS with AppView (no auth)

* bskyweb: update example .env files for appview
2023-08-24 16:00:45 -07:00

73 lines
1.6 KiB
Go

package main
import (
"os"
_ "github.com/joho/godotenv/autoload"
logging "github.com/ipfs/go-log"
"github.com/urfave/cli/v2"
)
var log = logging.Logger("bskyweb")
func init() {
logging.SetAllLoggers(logging.LevelDebug)
//logging.SetAllLoggers(logging.LevelWarn)
}
func main() {
run(os.Args)
}
func run(args []string) {
app := cli.App{
Name: "bskyweb",
Usage: "web server for bsky.app web app (SPA)",
}
app.Commands = []*cli.Command{
&cli.Command{
Name: "serve",
Usage: "run the server",
Action: serve,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "appview-host",
Usage: "method, hostname, and port of PDS instance",
Value: "http://localhost:2584",
// retain old PDS env var for easy transition
EnvVars: []string{"ATP_APPVIEW_HOST", "ATP_PDS_HOST"},
},
&cli.StringFlag{
Name: "mailmodo-api-key",
Usage: "Mailmodo API key",
Required: false,
EnvVars: []string{"MAILMODO_API_KEY"},
},
&cli.StringFlag{
Name: "mailmodo-list-name",
Usage: "Mailmodo contact list to add email addresses to",
Required: false,
EnvVars: []string{"MAILMODO_LIST_NAME"},
},
&cli.StringFlag{
Name: "http-address",
Usage: "Specify the local IP/port to bind to",
Required: false,
Value: ":8100",
EnvVars: []string{"HTTP_ADDRESS"},
},
&cli.BoolFlag{
Name: "debug",
Usage: "Enable debug mode",
Value: false,
Required: false,
EnvVars: []string{"DEBUG"},
},
},
},
}
app.RunAndExitOnError()
}