Skip to content

Commit

Permalink
livepeer_cli: use the O's currently registered Service URI as default
Browse files Browse the repository at this point in the history
address

When changing config options for the Orchestrator via livepeer_cli, the
public host:port of the node is requested for the configuration to be
applied successfully. This host:port address defaults to using the
ip-address of the node instead of using the global domain name that is
registered when setting up an O node. Use the registered Service URI as
the default option such that the entry can be left blank when
configuring options via the livepeer-cli.
  • Loading branch information
emranemran committed May 20, 2022
1 parent bc486b7 commit 7951465
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
### Bug Fixes 🐞

#### CLI
- \#2416 Use the O's currently registered Service URI as default address

#### General

Expand Down
12 changes: 12 additions & 0 deletions build.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
GO111MODULE=on CGO_ENABLED=1 CGO_CFLAGS="" CGO_LDFLAGS=" -framework CoreFoundation -framework Security" go build -o "./" -tags "testnet" -ldflags="-X github.com/livepeer/go-livepeer/core.LivepeerVersion=0.5.30-660a0b58-dirty" cmd/livepeer/*.go
# github.com/livepeer/lpms/ffmpeg
decoder.c:234:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
GO111MODULE=on CGO_ENABLED=1 CGO_CFLAGS="" CGO_LDFLAGS=" -framework CoreFoundation -framework Security" go build -o "./" -tags "testnet" -ldflags="-X github.com/livepeer/go-livepeer/core.LivepeerVersion=0.5.30-660a0b58-dirty" cmd/livepeer_cli/*.go
# github.com/livepeer/lpms/ffmpeg
decoder.c:234:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
GO111MODULE=on CGO_ENABLED=1 CGO_CFLAGS="" CGO_LDFLAGS=" -framework CoreFoundation -framework Security" go build -o "./" -ldflags="-X github.com/livepeer/go-livepeer/core.LivepeerVersion=0.5.30-660a0b58-dirty" cmd/livepeer_router/*.go
# github.com/livepeer/lpms/ffmpeg
decoder.c:234:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
GO111MODULE=on CGO_ENABLED=1 CGO_CFLAGS="" CGO_LDFLAGS=" -framework CoreFoundation -framework Security" go build -o "./" -ldflags="-X github.com/livepeer/go-livepeer/core.LivepeerVersion=0.5.30-660a0b58-dirty" cmd/livepeer_bench/*.go
# github.com/livepeer/lpms/ffmpeg
decoder.c:234:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
16 changes: 13 additions & 3 deletions cmd/livepeer_cli/wizard_transcoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ func myHostPort() string {
// http://whatismyipaddress.com/api
// http://ipinfo.io/ip
ip := strings.TrimSpace(httpGet("https://api.ipify.org/?format=text"))
return ip + ":" + defaultRPCPort
return "https://" + ip + ":" + defaultRPCPort
}

func (w *wizard) promptOrchestratorConfig() (float64, float64, int, int, string) {
var (
blockRewardCut float64
feeCut float64
addr string
)

orch, _, err := w.getOrchestratorInfo()
Expand All @@ -66,13 +67,16 @@ func (w *wizard) promptOrchestratorConfig() (float64, float64, int, int, string)
fmt.Printf("Enter the price for %d pixels in Wei (required) ", pixelsPerUnit)
pricePerUnit := w.readDefaultInt(0)

addr := myHostPort()
if orch.ServiceURI == "" {
addr = myHostPort()
} else {
addr = orch.ServiceURI
}
fmt.Printf("Enter the public host:port of node (default: %v)", addr)
serviceURI := w.readStringAndValidate(func(in string) (string, error) {
if "" == in {
in = addr
}
in = "https://" + in
uri, err := url.ParseRequestURI(in)
if err != nil {
return "", err
Expand Down Expand Up @@ -166,6 +170,12 @@ func (w *wizard) activateOrchestrator() {
}

func (w *wizard) setOrchestratorConfig() {

if w.offchain {
fmt.Println("Cannot set Orchestrator config in off-chain mode")
return
}

fmt.Printf("Current token balance: %v\n", w.getTokenBalance())

val := w.getOrchestratorConfigFormValues()
Expand Down
4 changes: 4 additions & 0 deletions makeme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export PKG_CONFIG_PATH=~/compiled/lib/pkgconfig
export BUILD_TAGS=testnet
time make > build.log 2>&1; echo $?

0 comments on commit 7951465

Please sign in to comment.