Skip to content

Conversation

@mkysel
Copy link
Collaborator

@mkysel mkysel commented Sep 16, 2025

Allow the CLI to load configuration via HTTP(S) or file URLs and enforce a 10 KiB read limit in config.ContractOptionsFromEnv in validation.go

This change updates config.ContractOptionsFromEnv to accept configuration paths as local filesystem paths or URLs with http, https, or file schemes, applies a 10s HTTP client timeout, enforces 2xx responses, and limits reads to 10 KiB with contextual error wrapping. It also adds net/http to imports and wraps JSON unmarshal errors with context.

  • Add HTTP fetching with 10s timeout and 2xx status requirement in config.ContractOptionsFromEnv in validation.go
  • Support file:// URLs with path normalization and 10 KiB read limit in config.ContractOptionsFromEnv in validation.go
  • Apply 10 KiB read limit for local files and wrap errors with context in config.ContractOptionsFromEnv in validation.go
  • Import net/http in validation.go

📍Where to Start

Start with config.ContractOptionsFromEnv in pkg/config/validation.go, which contains the URL/file path handling, HTTP client logic, read limits, and error wrapping.


Macroscope summarized 27b96e7.

@mkysel mkysel requested a review from a team as a code owner September 16, 2025 19:45
@graphite-app
Copy link

graphite-app bot commented Sep 16, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • Queue - adds this PR to the back of the merge queue
  • Hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@mkysel mkysel merged commit 6e0c00b into main Sep 17, 2025
10 checks passed
@mkysel mkysel deleted the mkysel/allow-using-http-config-paths branch September 17, 2025 13:49
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.

3 participants