-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30492a9
commit a9c9f13
Showing
17 changed files
with
78 additions
and
78 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 |
---|---|---|
@@ -1,23 +1,22 @@ | ||
import type { Core } from '@strapi/types'; | ||
|
||
import { defineProvider } from './provider'; | ||
import loadAdmin from '../loaders/admin'; | ||
|
||
export default { | ||
init(strapi: Core.Strapi) { | ||
export default defineProvider({ | ||
init(strapi) { | ||
strapi.add('admin', () => require('@strapi/admin/strapi-server')); | ||
}, | ||
|
||
async register(strapi: Core.Strapi) { | ||
async register(strapi) { | ||
await loadAdmin(strapi); | ||
|
||
await strapi.get('admin')?.register({ strapi }); | ||
}, | ||
|
||
async bootstrap(strapi: Core.Strapi) { | ||
async bootstrap(strapi) { | ||
await strapi.get('admin')?.bootstrap({ strapi }); | ||
}, | ||
|
||
async destroy(strapi: Core.Strapi) { | ||
async destroy(strapi) { | ||
await strapi.get('admin')?.destroy({ strapi }); | ||
}, | ||
}; | ||
}); |
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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import type { Core } from '@strapi/types'; | ||
|
||
import { defineProvider } from './provider'; | ||
import { createCoreStore, coreStoreModel } from '../services/core-store'; | ||
|
||
export default { | ||
init(strapi: Core.Strapi) { | ||
export default defineProvider({ | ||
init(strapi) { | ||
strapi.get('models').add(coreStoreModel); | ||
strapi.add('coreStore', () => createCoreStore({ db: strapi.db })); | ||
}, | ||
}; | ||
}); |
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 |
---|---|---|
@@ -1,20 +1,19 @@ | ||
import type { Core } from '@strapi/types'; | ||
|
||
import { defineProvider } from './provider'; | ||
import createCronService from '../services/cron'; | ||
|
||
export default { | ||
init(strapi: Core.Strapi) { | ||
export default defineProvider({ | ||
init(strapi) { | ||
strapi.add('cron', () => createCronService()); | ||
}, | ||
async bootstrap(strapi: Core.Strapi) { | ||
async bootstrap(strapi) { | ||
if (strapi.config.get('server.cron.enabled', true)) { | ||
const cronTasks = strapi.config.get('server.cron.tasks', {}); | ||
strapi.get('cron').add(cronTasks); | ||
} | ||
|
||
strapi.get('cron').start(); | ||
}, | ||
async destroy(strapi: Core.Strapi) { | ||
async destroy(strapi) { | ||
strapi.get('cron').destroy(); | ||
}, | ||
}; | ||
}); |
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,10 @@ | ||
import type { Core } from '@strapi/types'; | ||
|
||
export type Provider = { | ||
init?: (strapi: Core.Strapi) => void; | ||
register?: (strapi: Core.Strapi) => Promise<void>; | ||
bootstrap?: (strapi: Core.Strapi) => Promise<void>; | ||
destroy?: (strapi: Core.Strapi) => Promise<void>; | ||
}; | ||
|
||
export const defineProvider = (provider: Provider) => provider; |
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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
import type { Core } from '@strapi/types'; | ||
|
||
import { defineProvider } from './provider'; | ||
import createTelemetry from '../services/metrics'; | ||
|
||
export default { | ||
init(strapi: Core.Strapi) { | ||
export default defineProvider({ | ||
init(strapi) { | ||
strapi.add('telemetry', () => createTelemetry(strapi)); | ||
}, | ||
async register(strapi: Core.Strapi) { | ||
async register(strapi) { | ||
strapi.get('telemetry').register(); | ||
}, | ||
async bootstrap(strapi: Core.Strapi) { | ||
async bootstrap(strapi) { | ||
strapi.get('telemetry').bootstrap(); | ||
}, | ||
async destroy(strapi: Core.Strapi) { | ||
async destroy(strapi) { | ||
strapi.get('telemetry').destroy(); | ||
}, | ||
}; | ||
}); |
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
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