diff --git a/packages/indiekit/config/defaults.js b/packages/indiekit/config/defaults.js index 70c65d888..1e6959730 100644 --- a/packages/indiekit/config/defaults.js +++ b/packages/indiekit/config/defaults.js @@ -15,43 +15,46 @@ const mediaEndpoint = new MediaEndpoint(); const micropubEndpoint = new MicropubEndpoint(); const shareEndpoint = new ShareEndpoint(); -export const defaultConfig = { - application: { - endpoints: [ - mediaEndpoint, - micropubEndpoint, - shareEndpoint - ], - hasDatabase: false, - locale: 'en', - mongodbUrl: false, - middleware: { - authenticate, - indieauth - }, - name: 'Indiekit', - navigationItems: [], - repository: package_.repository, - routes: [], - themeColor: '#0000ee', - version: package_.version, - views: [ - path.join(__dirname, '..', 'views') - ] +const application = { + endpoints: [ + mediaEndpoint, + micropubEndpoint, + shareEndpoint + ], + hasDatabase: false, + locale: 'en', + mongodbUrl: false, + middleware: { + authenticate, + indieauth }, - publication: { - categories: [], - me: null, - postTemplate: null, - postTypes: [], - preset: null, - slugSeparator: '-', - store: null, - syndicationTargets: [], - timeZone: 'UTC', - tokenEndpoint: 'https://tokens.indieauth.com/token' - }, - server: { - port: process.env.PORT || '3000' - } + name: 'Indiekit', + navigationItems: [], + repository: package_.repository, + routes: [], + themeColor: '#0000ee', + version: package_.version, + views: [ + path.join(__dirname, '..', 'views') + ] +}; + +const publication = { + categories: [], + locale: application.locale, + me: null, + postTemplate: null, + postTypes: [], + preset: null, + slugSeparator: '-', + store: null, + syndicationTargets: [], + timeZone: 'UTC', + tokenEndpoint: 'https://tokens.indieauth.com/token' }; + +const server = { + port: process.env.PORT || '3000' +}; + +export const defaultConfig = {application, publication, server}; diff --git a/packages/indiekit/index.js b/packages/indiekit/index.js index c336981d8..5731e52a2 100644 --- a/packages/indiekit/index.js +++ b/packages/indiekit/index.js @@ -55,8 +55,7 @@ export const Indiekit = class { } async init() { - const {locale, mongodbUrl} = this.application; - const database = await mongodbConfig(mongodbUrl); + const database = await mongodbConfig(this.application.mongodbUrl); // Setup databases if (database) { @@ -71,7 +70,6 @@ export const Indiekit = class { // Update publication configuration this.publication.categories = await getCategories(cache, this.publication); - this.publication.locale = this.publication.locale || locale; this.publication.postTemplate = getPostTemplate(this.publication); this.publication.postTypes = getPostTypes(this.publication); diff --git a/packages/indiekit/tests/routes/status.js b/packages/indiekit/tests/routes/status.js index 73375db59..b698774b0 100644 --- a/packages/indiekit/tests/routes/status.js +++ b/packages/indiekit/tests/routes/status.js @@ -3,8 +3,6 @@ import supertest from 'supertest'; import {defaultConfig} from '../../config/defaults.js'; import {serverConfig} from '../../config/server.js'; -// TODO: Shouldn’t need to set additional settings here -defaultConfig.publication.locale = 'en'; const request = supertest(serverConfig(defaultConfig)); test('Returns status page', async t => {