Skip to content

Commit

Permalink
add '--follow-head-insecure'
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Jun 3, 2024
1 parent 6e36849 commit a21f247
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.1.6

* Add `--follow-head-insecure` flag to allow insecure ssl connection to a block-meta service

## v1.1.5

* Add a `follow-head` mode. It enables the sink noop to follow the chain's head when a block-meta url is provided (The block-meta is used to fetch the head block info).
Expand Down
18 changes: 13 additions & 5 deletions cmd/substreams-sink-noop/main.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
package main

import (
"connectrpc.com/connect"
"context"
"crypto/sha256"
"crypto/tls"
"fmt"
pbbmsrv "github.com/streamingfast/blockmeta-service/server/pb/sf/blockmeta/v2"
"github.com/streamingfast/blockmeta-service/server/pb/sf/blockmeta/v2/pbbmsrvconnect"
"gopkg.in/yaml.v3"
"hash"
"net/http"
"os"
"strconv"
"strings"
"time"

"connectrpc.com/connect"
pbbmsrv "github.com/streamingfast/blockmeta-service/server/pb/sf/blockmeta/v2"
"github.com/streamingfast/blockmeta-service/server/pb/sf/blockmeta/v2/pbbmsrvconnect"
"gopkg.in/yaml.v3"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
Expand Down Expand Up @@ -64,6 +66,7 @@ func main() {
flags.Uint64("print-output-data-hash-interval", 0, "If non-zero, will hash the output for quickly comparing for differences")
flags.Uint64("follow-head-substreams-segment", 1000, "")
flags.String("follow-head-blockmeta-url", "", "Block meta URL to follow head block, when provided, the sink enable the follow head mode (if block range not provided)")
flags.Bool("follow-head-insecure", false, "Skip tls verification when connecting to blockmeta service")
flags.Uint64("follow-head-reversible-segment", 100, "Segment size for reversible block")
}),
PersistentFlags(func(flags *pflag.FlagSet) {
Expand Down Expand Up @@ -95,8 +98,13 @@ func run(cmd *cobra.Command, args []string) error {
reversibleSegmentSize := sflags.MustGetUint64(cmd, "follow-head-reversible-segment")
var blockmetaClient pbbmsrvconnect.BlockClient
var apiKey string

client := &http.Client{Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: sflags.MustGetBool(cmd, "follow-head-insecure")},
}}

if blockmetaUrl != "" {
blockmetaClient = pbbmsrvconnect.NewBlockClient(http.DefaultClient, blockmetaUrl)
blockmetaClient = pbbmsrvconnect.NewBlockClient(client, blockmetaUrl)
apiKey = os.Getenv("SUBSTREAMS_API_KEY")
if apiKey == "" {
return fmt.Errorf("missing SUBSTREAMS_API_KEY environment variable to use blockmeta service")
Expand Down

0 comments on commit a21f247

Please sign in to comment.