Skip to content

Implemented internal siteInfo endpoint#703

Merged
gwicke merged 3 commits into
wikimedia:masterfrom
Pchelolo:site-info-endpoint
Nov 4, 2016
Merged

Implemented internal siteInfo endpoint#703
gwicke merged 3 commits into
wikimedia:masterfrom
Pchelolo:site-info-endpoint

Conversation

@Pchelolo
Copy link
Copy Markdown
Contributor

@Pchelolo Pchelolo commented Nov 2, 2016

For #699 we need to have an internal siteinfo endpoint, so I've implemented it.

But I went even further - the endpoint now returns the baseUri property that allows us to configure how RESTBase is exposed publicly in one place. This requires a config change to be deployed before this can go out.

Comment thread lib/content_location_filter.js Outdated
return res;
}
return hyper.get({
uri: new URI([req.params.domain, 'sys', 'action', 'siteinfo'])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It might be worth wrapping this in a utility method (toAbsoluteURI or the like).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 on that. That method could also extract the body of the response right away to be compatible with the current code.

Comment thread lib/content_location_filter.js Outdated

return next(hyper, req)
.then(attachLocation)
.catch(attachLocation)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: You can use .then(attachLocation, attachLocation) instead.

@gwicke
Copy link
Copy Markdown
Member

gwicke commented Nov 3, 2016

LGTM overall, but I didn't review extremely thoroughly.

@Pchelolo
Copy link
Copy Markdown
Contributor Author

Pchelolo commented Nov 3, 2016

@gwicke @d00rman Updated, addressed all comments.

Comment thread sys/action.js
body: '{{request.body}}',
}).expand;
} else {
if (!options.apiUriTemplate || !options.baseUriTemplate) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor: Add baseUriTemplate to the error message below.

Comment thread sys/parsoid.js Outdated
hyper.log('warn/bg-updates', e);
return mwUtil.getSiteInfo(hyper, req)
.then((siteInfo) => {
const baseUri = siteInfo.baseUri.replace(/^htts?:/, '');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/htts/https/

@Pchelolo
Copy link
Copy Markdown
Contributor Author

Pchelolo commented Nov 4, 2016

@d00rman Done, addressed the comments. Would be nice to get it in, because #702 depends on it.

@Pchelolo
Copy link
Copy Markdown
Contributor Author

Pchelolo commented Nov 4, 2016

Created a puppet config change here: https://gerrit.wikimedia.org/r/#/c/319897/

That config change must be deployed before this PR is.

@gwicke
Copy link
Copy Markdown
Member

gwicke commented Nov 4, 2016

LGTM. Any reason to delay the merge?

@gwicke gwicke merged commit 1460a22 into wikimedia:master Nov 4, 2016
@Krenair
Copy link
Copy Markdown
Member

Krenair commented Nov 5, 2016

You didn't update config.example.yaml?

@Pchelolo
Copy link
Copy Markdown
Contributor Author

Pchelolo commented Nov 5, 2016

Right @Krenair nice catch, thank you! Done in #707

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants