|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- package main
-
- import (
- "fmt"
- "net/http"
-
- "github.com/gorilla/mux"
- "github.com/imosed/signet/data"
- "github.com/imosed/signet/endpoints"
- "github.com/rs/zerolog"
- "github.com/rs/zerolog/log"
- "github.com/spf13/viper"
- )
-
- var err error
-
- // Testnet wallet: GDQZ34LBZSUYFR3DSDYFDLNYDHRXPUB76FIW2FTESYHRUOGZ6GXN5LOS
- // Testnet secret: SCDYZYNZIDYHU3HNIBDZEVCRD2QB2VOZWJR3XP63FA6AOC6GQQSZ3C3U
-
- func main() {
- viper.SetConfigFile("config.production.json")
- err = viper.ReadInConfig()
- if err != nil {
- log.Error().Err(err).Msg("Could not read in Viper config")
- }
-
- zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
-
- data.InitializeDatabase()
-
- go endpoints.InitializeContributionStreams()
-
- router := mux.NewRouter()
- router.HandleFunc("/GetRewardFunds", endpoints.GetRewardFunds)
- router.HandleFunc("/GetRewardFund", endpoints.GetRewardFund)
- router.HandleFunc("/GetContributions", endpoints.GetContributions)
- router.HandleFunc("/CreateQueue", endpoints.CreateQueue)
- router.HandleFunc("/GetQueues", endpoints.GetQueues)
- router.HandleFunc("/GetQueueMembers", endpoints.GetQueueMembers)
- router.HandleFunc("/EditQueue", endpoints.EditQueue)
- router.HandleFunc("/CreateRewardFund", endpoints.CreateRewardFund)
- router.HandleFunc("/CloseRewardFund", endpoints.CloseRewardFund)
- router.HandleFunc("/SubmitRewardFund", endpoints.SubmitFund)
- router.HandleFunc("/DistributeRewardFund", endpoints.DistributeRewards)
- router.HandleFunc("/GetUsers", endpoints.GetUsers)
- router.HandleFunc("/GetBalance", endpoints.GetBalance)
- router.HandleFunc("/Contribute", endpoints.Contribute)
- router.HandleFunc("/ContributorStream", endpoints.ContributorStream)
- router.HandleFunc("/Login", endpoints.Login)
- router.HandleFunc("/Register", endpoints.Register)
- router.HandleFunc("/NearlyCompleteFunds", endpoints.NearlyCompleteFunds)
- router.HandleFunc("/EscalatePrivileges", endpoints.EscalatePrivileges)
- router.HandleFunc("/UsersExist", endpoints.UsersExist)
-
- port := viper.GetInt("app.port")
- fmt.Printf("Running on port %d...\n", port)
- err = http.ListenAndServe(fmt.Sprintf(":%d", port), router)
- if err != nil {
- log.Error().Err(err).Msg(fmt.Sprintf("Could not bind to port %d", port))
- }
- }
|