Skip to content

fix pointer issue. Add branch reading for config. - #29

Merged
jppade merged 2 commits into
masterfrom
fix-pointer-issue
May 25, 2026
Merged

fix pointer issue. Add branch reading for config.#29
jppade merged 2 commits into
masterfrom
fix-pointer-issue

Conversation

@jppade

@jppade jppade commented May 25, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the config-loading path to support reading config files from a specific GitHub branch (via the GitHub Contents API) and refactors call sites accordingly, while also adjusting a few scraper/oracle behaviors.

Changes:

  • Add optional branch support when reading remote config files (GitHub ?ref=), and refactor utils.ReadFile / models.Get*Config signatures to accept a branch.
  • Wire branch selection into Twelvedata and Belo scrapers via new *_BRANCH_MARKET_CONFIG environment variables.
  • Adjust some runtime behavior (e.g., TwelveData commodity quote URL parameters; oracle updater no longer exits on update failure).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/utils/file.go Adds branch-aware GitHub remote config fetching and changes ReadFile to remote-first with local fallback.
pkg/models/rwaConfig.go Threads branch parameter through config-loading helpers.
pkg/scraper/twelvedata.go Adds env-driven branch selection for config reloads and tweaks quote fetching to support commodities.
pkg/scraper/belo.go Adds env-driven branch selection for config reloads and updates logging calls.
pkg/scraper/rwaScraper.go Updates config-loading calls/signatures to pass a branch parameter (currently empty).
pkg/onchain/updater.go Changes oracle update error handling to log errors without exiting the executor loop.
Comments suppressed due to low confidence (1)

pkg/scraper/rwaScraper.go:502

  • RAW_WS_CONFIG points to config/rwa/rawWSConfig.json, which currently uses keys like HK_Stocks, US_Stocks, US_ETF, etc., but models.GetRWAConfig unmarshals into RWAConfig (expects Stocks, FX, Commodities, ETF). Because json.Unmarshal ignores unknown fields, this will silently load empty symbol lists and the scraper will effectively do nothing. Consider introducing a dedicated config struct/loader for rawWSConfig.json (or switch to the config file that matches RWAConfig).
func (scraper *RWAWSScraper) updateConfig(filename string, branch string) error {
	c, err := models.GetRWAConfig(filename, branch)
	if err != nil {
		return err
	}

	scraper.stockSymbols = c.Stocks
	scraper.fxTickers = c.FX
	scraper.commodities = c.Commodities
	scraper.etfs = c.ETF

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/utils/file.go Outdated
}

req, _ := http.NewRequest("GET", url, nil)
req, _ := http.NewRequest("GET", URL, nil)
Comment thread pkg/scraper/rwaScraper.go
@jppade
jppade merged commit d62a018 into master May 25, 2026
1 check passed
@jppade
jppade deleted the fix-pointer-issue branch May 25, 2026 08:11
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