-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #7628 With this PR we expose a public configuration endpoint. When /ghost is requested, we don't load and render the configurations into the template anymore. Instead, Ghost-Admin can request the public configuration endpoint. * 🎨 make configuration endpoint public * 🔥 remove loading configurations in admin app - do not render them into the default html page * ✨ load client credentials in configuration endpoint - this is not a security issue, because we have exposed this information anyway before (by rendering them into the requested html page) * 🎨 extend existing configuration integration test * ✨ tests: add ghost-auth to data generator * ✨ add functional test * 🔥 remove type/value pattern * 🎨 do not return stringified JSON objects
- Loading branch information
Showing
6 changed files
with
111 additions
and
63 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
var testUtils = require('../../../utils'), | ||
should = require('should'), | ||
supertest = require('supertest'), | ||
ghost = testUtils.startGhost, | ||
request; | ||
|
||
describe('Configuration API', function () { | ||
var accesstoken = ''; | ||
|
||
before(function (done) { | ||
// starting ghost automatically populates the db | ||
// TODO: prevent db init, and manage bringing up the DB with fixtures ourselves | ||
ghost().then(function (ghostServer) { | ||
request = supertest.agent(ghostServer.rootApp); | ||
}).then(function () { | ||
return testUtils.doAuth(request, 'posts'); | ||
}).then(function (token) { | ||
accesstoken = token; | ||
done(); | ||
}).catch(done); | ||
}); | ||
|
||
after(function (done) { | ||
testUtils.clearData().then(function () { | ||
done(); | ||
}).catch(done); | ||
}); | ||
|
||
describe('success', function () { | ||
it('can retrieve public configuration', function (done) { | ||
request.get(testUtils.API.getApiQuery('configuration/')) | ||
.expect('Content-Type', /json/) | ||
.expect('Cache-Control', testUtils.cacheRules.private) | ||
.expect(200) | ||
.end(function (err, res) { | ||
should.exist(res.body.configuration); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains 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
This file contains 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