this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

bigsky: initial deployment tweaks

- env var config for key config values
- split CLI parsing into run(), for integration tests
- dotenv loading, for dev with env vars

+32 -10
+32 -10
cmd/bigsky/main.go
··· 20 20 _ "net/http/pprof" 21 21 22 22 logging "github.com/ipfs/go-log" 23 + "github.com/joho/godotenv" 23 24 "github.com/urfave/cli/v2" 24 25 "go.opentelemetry.io/otel" 25 26 "go.opentelemetry.io/otel/attribute" ··· 38 39 } 39 40 40 41 func main() { 41 - app := cli.NewApp() 42 + 43 + // only try dotenv if it exists 44 + if _, err := os.Stat(".env"); err == nil { 45 + err := godotenv.Load() 46 + if err != nil { 47 + log.Fatal("Error loading .env file") 48 + } 49 + } 50 + 51 + run(os.Args) 52 + } 53 + 54 + func run(args []string) { 55 + 56 + app := cli.App{ 57 + Name: "bigsky", 58 + Usage: "atproto BGS/firehose daemon", 59 + } 42 60 43 61 app.Flags = []cli.Flag{ 44 62 &cli.BoolFlag{ 45 63 Name: "jaeger", 46 64 }, 47 65 &cli.StringFlag{ 48 - Name: "db", 49 - Value: "sqlite=data/bigsky/bgs.sqlite", 66 + Name: "db", 67 + Value: "sqlite=data/bigsky/bgs.sqlite", 68 + EnvVars: []string{"DATABASE_URL"}, 50 69 }, 51 70 &cli.StringFlag{ 52 - Name: "carstoredb", 53 - Value: "sqlite=data/bigsky/carstore.sqlite", 71 + Name: "carstoredb", 72 + Value: "sqlite=data/bigsky/carstore.sqlite", 73 + EnvVars: []string{"CARSTORE_DATABASE_URL"}, 54 74 }, 55 75 &cli.StringFlag{ 56 - Name: "carstore", 57 - Value: "data/bigsky/carstore", 76 + Name: "carstore", 77 + Value: "data/bigsky/carstore", 78 + EnvVars: []string{"CARSTORE_DIRECTORY"}, 58 79 }, 59 80 &cli.BoolFlag{ 60 81 Name: "dbtracing", 61 82 }, 62 83 &cli.StringFlag{ 63 - Name: "plc", 64 - Usage: "hostname of the plc server", 65 - Value: "https://plc.directory", 84 + Name: "plc", 85 + Usage: "hostname of the plc server (including https:// prefix)", 86 + Value: "https://plc.directory", 87 + EnvVars: []string{"ATP_PLC_HOST"}, 66 88 }, 67 89 &cli.BoolFlag{ 68 90 Name: "ssl-events",