Clean up api and blossom

This commit is contained in:
Jon Staab
2026-05-12 13:35:16 -07:00
parent f40e909863
commit ea145079f4
10 changed files with 409 additions and 537 deletions
+2 -3
View File
@@ -26,10 +26,9 @@ func main() {
}
// Load config for the specified relay
filename := fmt.Sprintf("%s.toml", *relay)
config, err := zooid.LoadConfig(filename)
config, err := zooid.LoadConfigFromId(*relay)
if err != nil {
fmt.Fprintln(os.Stderr, "No such config file", filename)
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
+2 -3
View File
@@ -40,10 +40,9 @@ func main() {
}
// Load config for the specified relay
filename := fmt.Sprintf("%s.toml", *relay)
config, err := zooid.LoadConfig(filename)
config, err := zooid.LoadConfigFromId(*relay)
if err != nil {
fmt.Fprintln(os.Stderr, "No such config file", filename)
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
+2 -4
View File
@@ -21,8 +21,6 @@ func main() {
port := zooid.Env("PORT")
apiHost := zooid.Env("API_HOST")
apiWhitelist := zooid.Env("API_WHITELIST")
configDir := zooid.Env("CONFIG")
pprofAddr := zooid.Env("PPROF_ADDR")
// pprof server — only starts when PPROF_ADDR is set. Bind to
@@ -50,8 +48,8 @@ func main() {
// Wrap with API handler if API_HOST is configured
var handler http.Handler = mainHandler
if apiHost != "" && apiWhitelist != "" {
apiHandler := zooid.NewAPIHandler(apiWhitelist, configDir)
if apiHost != "" {
apiHandler := zooid.NewAPIHandler()
handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Check if this request is for the API host
if r.Host == apiHost {