Skip to content

feat(live-runner): env-var fallback for register_runner provisioning fields#34

Closed
rickstaa wants to merge 1 commit into
ja/live-runnerfrom
rs/register-runner-env-defaults
Closed

feat(live-runner): env-var fallback for register_runner provisioning fields#34
rickstaa wants to merge 1 commit into
ja/live-runnerfrom
rs/register-runner-env-defaults

Conversation

@rickstaa

@rickstaa rickstaa commented Jun 29, 2026

Copy link
Copy Markdown
Member

Draft / showcase for discussion — follows up on the dynamic-pricing thread in #20.

Why

@j0sh —I noted hello-world "feels a bit strange since it relies on the app to create the argument and forward it," and that pricing belongs with the runner (deployment), not in go-livepeer. This shows what "provisioning is deploy config, out of app code" looks like in the SDK.

What

register_runner provisioning fields fall back to LIVEPEER_* env vars when omitted; an explicit argument always wins.

Field Env var
orchestrator_url / secret / runner_url LIVEPEER_ORCHESTRATOR_URL / _ORCH_SECRET / _RUNNER_URL
price_per_unit / pixels_per_unit / price_unit LIVEPEER_PRICE_PER_UNIT / _PIXELS_PER_UNIT / _PRICE_UNIT
capacity LIVEPEER_CAPACITY

App identity/behavior (app, mode, callbacks) stays in code.

# before: app forwards operator config
await register_runner(args.orchestrator, secret=args.orchSecret, runner_url=args.runner_url,
                      app="livepeer-sample/hello-world", price_per_unit=args.price)
# after: operator sets env at deploy time
await register_runner(app="livepeer-sample/hello-world")

Not a trust change — dynamic still reports the price either way; env vs arg only moves where the operator sets it. Static remains the orch-owned path.

+27/−7, one file, inline (matches the existing CUDA_VISIBLE_DEVICES read).

Open questions

  1. Env var names / LIVEPEER_* prefix ok?
  2. Scope — full provisioning set (connection + auth + pricing + capacity); too much?
  3. Update the example apps to drop the forwarding if this lands?

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ue3DyejYHXX5HYmjxtJZbg

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2789a00a-b2e8-4cc7-a4e7-012fabb1c458

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rs/register-runner-env-defaults

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…fields

Provisioning is an operator/deployment concern, not app logic. Today the app
must read and forward connection, auth, pricing and capacity into
register_runner() — pricing especially "feels strange" since the app just
forwards an operator-set value.

Let these be supplied via the environment when omitted, so an unchanged image
can be provisioned at deploy time (env / compose / k8s) without forwarding them
in code. An explicit argument always wins (env is the fallback, not an override):

  orchestrator_url -> LIVEPEER_ORCHESTRATOR_URL
  secret           -> LIVEPEER_ORCH_SECRET
  runner_url       -> LIVEPEER_RUNNER_URL
  price_per_unit   -> LIVEPEER_PRICE_PER_UNIT   (default 0)
  pixels_per_unit  -> LIVEPEER_PIXELS_PER_UNIT  (default 1)
  price_unit       -> LIVEPEER_PRICE_UNIT       (default "USD")
  capacity         -> LIVEPEER_CAPACITY         (default 1)

App identity/behavior (app, mode, callbacks) intentionally stays in code.

This is SDK ergonomics only — it does not change go-livepeer's trust model.
Dynamic registration still reports the price to the orchestrator either way;
env vs arg only changes where the operator configures it. Static remains the
path for orchestrator-owned pricing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ue3DyejYHXX5HYmjxtJZbg
@rickstaa rickstaa force-pushed the rs/register-runner-env-defaults branch from d4afe2b to 756654c Compare June 29, 2026 19:37
@j0sh

j0sh commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Env var fallback is a good idea at the application layer. Since this is a library I'm a little hesitant about injecting implicit / hidden state that may clash with the existing runtime environment. From what I can gather, library configuration via env vars is not really an encouraged practice either.

If we ship a "runner executable" that shells out to some command then it would be fine to have env vars for that. For this library call though, I'm not so sure.

@rickstaa

Copy link
Copy Markdown
Member Author

Env var fallback is a good idea at the application layer. Since this is a library I'm a little hesitant about injecting implicit / hidden state that may clash with the existing runtime environment. From what I can gather, library configuration via env vars is not really an encouraged practice either.

If we ship a "runner executable" that shells out to some command then it would be fine to have env vars for that. For this library call though, I'm not so sure.

Hey @j0sh I agree, we don't need to deal with this right now. This was just me doing some prototyping. Will clsoe for now.

@rickstaa rickstaa closed this Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants