bskyweb: proof-of-concept golang daemon to serve SPA (#275)
* gitignore: /dist/ * bskyweb: initial work-in-progress * bskyweb: import icons from bluesky-website * bskyweb: switch to pongo2 templates; iterate on views * bskyweb: example.env (and docs) * bskyweb: go fmt * bskyweb: remove plan file * bskyweb: README: tweak formatting * prettier: ignore /dist/, bskyweb templates --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
This commit is contained in:
parent
528e14fe90
commit
8629e167cd
21 changed files with 796 additions and 2 deletions
68
bskyweb/cmd/bskyweb/main.go
Normal file
68
bskyweb/cmd/bskyweb/main.go
Normal file
|
@ -0,0 +1,68 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
logging "github.com/ipfs/go-log"
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
var log = logging.Logger("bskyweb")
|
||||
|
||||
func init() {
|
||||
logging.SetAllLoggers(logging.LevelDebug)
|
||||
//logging.SetAllLoggers(logging.LevelWarn)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
// only try dotenv if it exists
|
||||
if _, err := os.Stat(".env"); err == nil {
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
log.Fatal("Error loading .env file")
|
||||
}
|
||||
}
|
||||
|
||||
run(os.Args)
|
||||
}
|
||||
|
||||
func run(args []string) {
|
||||
|
||||
app := cli.App{
|
||||
Name: "bskyweb",
|
||||
Usage: "web server for bsky.app web app (SPA)",
|
||||
}
|
||||
|
||||
app.Flags = []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "pds-host",
|
||||
Usage: "method, hostname, and port of PDS instance",
|
||||
Value: "http://localhost:4849",
|
||||
EnvVars: []string{"ATP_PDS_HOST"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "handle",
|
||||
Usage: "for PDS login",
|
||||
Required: true,
|
||||
EnvVars: []string{"ATP_AUTH_HANDLE"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "password",
|
||||
Usage: "for PDS login",
|
||||
Required: true,
|
||||
EnvVars: []string{"ATP_AUTH_PASSWORD"},
|
||||
},
|
||||
// TODO: local IP/port to bind on
|
||||
}
|
||||
|
||||
app.Commands = []*cli.Command{
|
||||
&cli.Command{
|
||||
Name: "serve",
|
||||
Usage: "run the server",
|
||||
Action: serve,
|
||||
},
|
||||
}
|
||||
app.RunAndExitOnError()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue