package main import ( "net/http" "git.minhas.io/asara/well-goknown/config" "git.minhas.io/asara/well-goknown/logger" "git.minhas.io/asara/well-goknown/matrix" "git.minhas.io/asara/well-goknown/nostr" "git.minhas.io/asara/well-goknown/redis" ) func main() { var err error l := logger.Get() // connect to redis redis.NostrRedisConn, err = redis.New("localhost:6379", "", redis.NostrKeyspace) if err != nil { l.Fatal().Msg("unable to connect to redis") } redis.LndRedisConn, err = redis.New("localhost:6379", "", redis.LndKeyspace) if err != nil { l.Fatal().Msg("unable to connect to redis") } // matrix endpoints l.Debug().Msg("enabling matrix server endpoint") http.HandleFunc("/.well-known/matrix/server", matrix.MatrixServer) l.Debug().Msg("enabling matrix client endpoint") http.HandleFunc("/.well-known/matrix/client", matrix.MatrixClient) // nostr endpoints l.Debug().Msg("enabling nostr user endpoint") http.HandleFunc("/.well-known/nostr.json", nostr.GetNostrAddr) addr := config.GetConfig().LndAddr if addr != "" { l.Debug().Msg("enabling nostr request endpoint") http.HandleFunc("/request/nostr", nostr.RequestNostrAddr) } // start server port := config.GetConfig().ListenAddr l.Info().Msgf("starting server on %s", port) http.ListenAndServe(port, nil) }