Lasa is a stateless proxy that generates a RSS or an Atom feed from a Standard.site publication. lasa.anhgelus.world
rss atom atprotocol standard-site atproto
2
fork

Configure Feed

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

feat(cli): generate config file

+64 -5
+1 -1
cmd/internal/print.go
··· 17 17 fmt.Println("Usage:", syntax) 18 18 fmt.Println(usage) 19 19 w := tabwriter.NewWriter(os.Stdout, 0, 2, 1, ' ', 0) 20 - if commands != nil { 20 + if len(commands) > 0 { 21 21 fmt.Fprintln(w) 22 22 fmt.Fprintln(w, "Commands:") 23 23 for _, c := range commands {
+39
cmd/lasad/config.go
··· 1 + package main 2 + 3 + import ( 4 + _ "embed" 5 + "fmt" 6 + "os" 7 + 8 + "tangled.org/anhgelus.world/lasa/cmd/internal" 9 + ) 10 + 11 + //go:embed default.toml 12 + var defaultConfig []byte 13 + 14 + func handleGenConfigHelp() { 15 + internal.Usage( 16 + `lasad gen-config`, 17 + "Generate a new config. Can destroy yours!", 18 + nil, 19 + flags, 20 + []string{ 21 + "lasad gen-config\t-\tgenerate a new config", 22 + }, 23 + ) 24 + if !help { 25 + os.Exit(1) 26 + } 27 + } 28 + 29 + func handleGenConfig(args []string) { 30 + if len(args) != 0 || help { 31 + handleGenConfigHelp() 32 + return 33 + } 34 + fmt.Println("writing default file at", configPath) 35 + err := os.WriteFile(configPath, defaultConfig, 0640) 36 + if err != nil { 37 + panic(err) 38 + } 39 + }
+1 -1
cmd/lasad/config/config.go
··· 50 50 return nil, err 51 51 } 52 52 var cfg Config 53 - return &cfg, toml.Unmarshal(b, cfg) 53 + return &cfg, toml.Unmarshal(b, &cfg) 54 54 }
+15
cmd/lasad/default.toml
··· 1 + domain = "example.org" 2 + port = 8000 3 + 4 + # if you are using valkey 5 + #[cache] 6 + #host = "localhost" 7 + #port = 6379 8 + #db = 0 9 + #duration = 60 # cache duration in minutes 10 + 11 + # if valkey requires auth 12 + #[cache.auth] 13 + #username = "" 14 + #password = "" 15 + #client_name = ""
+8 -3
cmd/lasad/main.go
··· 22 22 23 23 var commands = []internal.Command{ 24 24 {Name: "run", Usage: "run the daemon", Callback: handleRun}, 25 + {Name: "gen-config", Usage: "generate the config file", Callback: handleGenConfig}, 25 26 } 26 27 27 28 func main() { 28 29 flags.Parse(os.Args[1:]) 30 + if help { 31 + handleHelp() 32 + return 33 + } 29 34 args := flags.Args() 30 35 command := "run" 31 36 if len(args) > 0 { ··· 43 48 return 44 49 } 45 50 } 46 - handleHelp(args) 51 + handleHelp() 47 52 os.Exit(1) 48 53 } 49 54 50 - func handleHelp([]string) { 55 + func handleHelp() { 51 56 internal.Usage( 52 57 `lasad <command>`, 53 58 `Daemon running Lasa.`, 54 - nil, 59 + commands, 55 60 flags, 56 61 []string{ 57 62 "lasad\t-\trun the daemon",