2022-10-25 01:58:24 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2022-11-15 03:22:15 +00:00
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
2022-10-25 01:58:24 +00:00
|
|
|
|
2022-10-25 10:20:17 +00:00
|
|
|
"github.com/go-chi/chi/v5"
|
2022-11-15 03:22:15 +00:00
|
|
|
"github.com/jessevdk/go-flags"
|
2022-10-25 01:58:24 +00:00
|
|
|
)
|
|
|
|
|
2022-11-15 03:22:15 +00:00
|
|
|
type config struct {
|
|
|
|
OtsPort int `short:"p" long:"port" default:"3333"`
|
|
|
|
OtsApiPath string `long:"api_path" default:"/"`
|
|
|
|
OtsStaticDir string `long:"static_dir" default:"dist"`
|
|
|
|
OtsAssetUrl string `long:"assert_url" default:""`
|
|
|
|
OtsRpcDaemonUrl string `long:"rpc_daemon_url" default:"https://brilliant.staging.gfx.town"`
|
|
|
|
OtsBeaconApiUrl string `long:"beacon_api_url" default:"" `
|
|
|
|
}
|
2022-10-25 12:32:28 +00:00
|
|
|
|
2022-11-15 03:22:15 +00:00
|
|
|
var Conf config
|
2022-10-25 12:32:28 +00:00
|
|
|
|
2022-11-15 03:22:15 +00:00
|
|
|
var parser = flags.NewParser(&Conf, flags.Default)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
|
|
|
parser.Parse()
|
|
|
|
r := chi.NewRouter()
|
|
|
|
// route the server
|
|
|
|
RouteServer(r, Conf)
|
|
|
|
log.Printf("Running with config: %+v", Conf)
|
|
|
|
err := http.ListenAndServe(fmt.Sprintf(":%d", Conf.OtsPort), r)
|
|
|
|
if err != nil {
|
|
|
|
log.Println(err)
|
2022-10-25 01:58:24 +00:00
|
|
|
}
|
|
|
|
}
|