mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-31 23:41:22 +00:00
81c2e4e94b
* first pass on pow faucet for testnet * delete unused thing * remove unneeded thing * remove other thing * https & remove a log * don't force redirect on https, its not working? * some renaming of stuff * lint * lint * some stablity config * move protos to proto directory, add generated pb file for go users * add health probe * add hpa and request cpu * handle err * some more config
39 lines
860 B
Go
39 lines
860 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"net"
|
|
|
|
recaptcha "github.com/prestonvanloon/go-recaptcha"
|
|
faucetpb "github.com/prysmaticlabs/prysm/proto/faucet"
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/grpc/reflection"
|
|
)
|
|
|
|
var (
|
|
port = flag.Int("port", 8000, "Port to server gRPC service")
|
|
recaptchaSecret = flag.String("recaptcha_secret", "", "Secret to verify recaptcha")
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
s := grpc.NewServer()
|
|
fmt.Println("recaptcha = " + *recaptchaSecret)
|
|
faucetpb.RegisterFaucetServiceServer(s, &faucetServer{
|
|
r: recaptcha.Recaptcha{RecaptchaPrivateKey: *recaptchaSecret},
|
|
})
|
|
|
|
reflection.Register(s)
|
|
|
|
fmt.Printf("Serving gRPC requests on port %d\n", *port)
|
|
if err := s.Serve(lis); err != nil {
|
|
fmt.Printf("Error: %v", err)
|
|
}
|
|
}
|