Skip to content
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

Merged
merged 9 commits into from
May 18, 2020
Merged

Generate index.json #470

merged 9 commits into from
May 18, 2020

Conversation

mtojek
Copy link
Contributor

@mtojek mtojek commented May 15, 2020

Issue: #469

Let's first merge this PR: #468

@mtojek mtojek self-assigned this May 15, 2020
@elasticmachine
Copy link

elasticmachine commented May 15, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request Generate index.json #470 updated]

  • Start Time: 2020-05-18T08:32:34.925+0000

  • Duration: 4 min 15 sec (255151)

Copy link
Member

@ruflin ruflin left a 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",
Copy link
Member

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?

Copy link
Contributor Author

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",
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@mtojek
Copy link
Contributor Author

mtojek commented May 18, 2020

Changelog?

Yup, already added.

@mtojek mtojek merged commit 8dce9ce into elastic:master May 18, 2020
Copy link

@jfsiii jfsiii left a 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))
Copy link

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?

Copy link
Contributor Author

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.

@mtojek
Copy link
Contributor Author

mtojek commented May 25, 2020

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.

This PR is only for the main index.json file. I've just started working on the package index.json files (PR soon).

@jfsiii
Copy link

jfsiii commented May 25, 2020

This PR is only for the main index.json file.

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

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.

4 participants