fix pointer issue. Add branch reading for config. - #29
Merged
Conversation
There was a problem hiding this comment.
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
branchsupport when reading remote config files (GitHub?ref=), and refactorutils.ReadFile/models.Get*Configsignatures to accept a branch. - Wire branch selection into Twelvedata and Belo scrapers via new
*_BRANCH_MARKET_CONFIGenvironment 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_CONFIGpoints toconfig/rwa/rawWSConfig.json, which currently uses keys likeHK_Stocks,US_Stocks,US_ETF, etc., butmodels.GetRWAConfigunmarshals intoRWAConfig(expectsStocks,FX,Commodities,ETF). Becausejson.Unmarshalignores unknown fields, this will silently load empty symbol lists and the scraper will effectively do nothing. Consider introducing a dedicated config struct/loader forrawWSConfig.json(or switch to the config file that matchesRWAConfig).
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.
| } | ||
|
|
||
| req, _ := http.NewRequest("GET", url, nil) | ||
| req, _ := http.NewRequest("GET", URL, nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.