-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate index.json #470
Generate index.json #470
Conversation
💚 Build SucceededExpand to view the summary
Build stats
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog?
index.go
Outdated
func indexHandler(cacheTime time.Duration) (func(w http.ResponseWriter, r *http.Request), error) { | ||
data := indexData{ | ||
ServiceName: "package-registry", | ||
Version: "0.4.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Could have this as a constant in the main.go file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
index.go
Outdated
|
||
func indexHandler(cacheTime time.Duration) (func(w http.ResponseWriter, r *http.Request), error) { | ||
data := indexData{ | ||
ServiceName: "package-registry", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Could we have this as a constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Yup, already added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy there is now a single source of truth for this information.
I would prefer to keep it in index.json so other tools can read it from the filesystem. This approach requires an HTTP request if I understand correctly.
Not hard to change later if we want, though. Thanks for cleaning this up.
router.HandleFunc("/search", searchHandler(packagesBasePath, config.CacheTimeSearch)) | ||
router.HandleFunc("/categories", categoriesHandler(packagesBasePath, config.CacheTimeCategories)) | ||
router.HandleFunc("/health", healthHandler) | ||
router.HandleFunc("/favicon.ico", faviconHandleFunc) | ||
router.PathPrefix("/").HandlerFunc(catchAll(http.Dir(config.PublicDir), config.CacheTimeCatchAll)) | ||
router.PathPrefix("/epr").HandlerFunc(catchAll(http.Dir(config.PublicDir), config.CacheTimeCatchAll)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtojtek are the /epr and /package routes new?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the user perspective - no, they're already exposed.
Speaking about the implementation, this has been already adjusted (see the master branch). Archives exposed via the /epr
endpoint are built dynamically, not served from the file system.
This PR is only for the main |
Yes, that was my understanding. I'll try to keep an eye out, but can you add me on that PR when you submit it? Thanks |
Issue: #469
Let's first merge this PR: #468