File tree 4 files changed +13
-9
lines changed
4 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export const expressConfig = (Indiekit) => {
42
42
// Session
43
43
app . use (
44
44
cookieSession ( {
45
- name : Indiekit . application . name ,
45
+ name : Indiekit . config . application . name ,
46
46
secret : crypto . randomUUID ( ) ,
47
47
maxAge : 7 * 24 * 60 * 60 * 1000 , // 7 days,
48
48
} ) ,
Original file line number Diff line number Diff line change @@ -26,16 +26,16 @@ export const Indiekit = class {
26
26
*/
27
27
constructor ( config ) {
28
28
this . config = config ;
29
- this . application = this . config . application ;
30
29
this . package = package_ ;
31
- this . publication = this . config . publication ;
32
30
33
31
this . collections = new Map ( ) ;
34
32
this . endpoints = new Set ( ) ;
35
33
this . installedPlugins = new Set ( ) ;
34
+ this . locale = config . application ?. locale ;
36
35
this . locales = locales ;
37
- this . mongodbUrl = config . application . mongodbUrl ;
36
+ this . mongodbUrl = config . application ? .mongodbUrl ;
38
37
this . postTypes = new Map ( ) ;
38
+ this . publication = this . config . publication ;
39
39
this . stores = new Set ( ) ;
40
40
this . validationSchemas = new Map ( ) ;
41
41
}
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { getCachedResponse } from "./cache.js";
7
7
* @returns {Promise<Array> } Array of categories
8
8
*/
9
9
export const getCategories = async ( Indiekit ) => {
10
- const { application , cache , publication } = Indiekit ;
10
+ const { cache , config , publication } = Indiekit ;
11
11
const { categories } = publication ;
12
12
13
13
let categoryList = [ ] ;
@@ -17,7 +17,11 @@ export const getCategories = async (Indiekit) => {
17
17
}
18
18
19
19
if ( categories && URL . canParse ( categories ) ) {
20
- categoryList = await getCachedResponse ( cache , application . ttl , categories ) ;
20
+ categoryList = await getCachedResponse (
21
+ cache ,
22
+ config . application . ttl ,
23
+ categories ,
24
+ ) ;
21
25
}
22
26
23
27
if ( categoryList ) {
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import i18n from "i18n";
8
8
export const internationalisation = ( Indiekit ) =>
9
9
function ( request , response , next ) {
10
10
try {
11
- const { application , localeCatalog } = Indiekit ;
11
+ const { locale , localeCatalog } = Indiekit ;
12
12
13
13
i18n . configure ( {
14
14
cookie : "locale" ,
@@ -22,8 +22,8 @@ export const internationalisation = (Indiekit) =>
22
22
i18n . init ( request , response ) ;
23
23
24
24
// Override system locale with configured value
25
- if ( application . locale ) {
26
- response . locals . setLocale ( application . locale ) ;
25
+ if ( locale ) {
26
+ response . locals . setLocale ( locale ) ;
27
27
}
28
28
29
29
next ( ) ;
You can’t perform that action at this time.
0 commit comments