@@ -109,6 +109,22 @@ const globals = async () => {
109109 global . LOG = global . BOOT ;
110110} ;
111111
112+ const reactiumBootHooks = async ( ) => {
113+ // include boot DDD artifacts
114+ globby ( [
115+ `${ rootPath } /.core/**/reactium-boot.js` ,
116+ `${ rootPath } /src/**/reactium-boot.js` ,
117+ `${ rootPath } /reactium_modules/**/reactium-boot.js` ,
118+ `${ rootPath } /node_modules/**/reactium-plugin/**/reactium-boot.js` ,
119+ ] ) . map ( item => {
120+ const p = path . normalize ( item ) ;
121+ require ( p ) ;
122+ } ) ;
123+
124+ ReactiumBoot . Hook . runSync ( 'sdk-init' , ReactiumBoot ) ;
125+ await ReactiumBoot . Hook . run ( 'sdk-init' , ReactiumBoot ) ;
126+ } ;
127+
112128global . rootPath = path . resolve ( __dirname , '..' ) ;
113129
114130const ssrStartup = async ( ) => {
@@ -168,11 +184,13 @@ const ssrStartup = async () => {
168184} ;
169185
170186const apiConfig = async ( ) => {
171- const apiConfig = ReactiumBoot . API . ActiniumConfig ;
187+ if ( ReactiumBoot . API && ReactiumBoot . API . ActiniumConfig ) {
188+ const apiConfig = ReactiumBoot . API . ActiniumConfig ;
172189
173- global . parseAppId = apiConfig . parseAppId ;
174- global . actiniumAppId = apiConfig . actiniumAppId ;
175- global . restAPI = apiConfig . restAPI ;
190+ global . parseAppId = apiConfig . parseAppId ;
191+ global . actiniumAppId = apiConfig . actiniumAppId ;
192+ global . restAPI = apiConfig . restAPI ;
193+ }
176194
177195 global . app = express ( ) ;
178196} ;
@@ -195,7 +213,7 @@ const registeredMiddleware = async () => {
195213 order : Enums . priority . highest ,
196214 } ) ;
197215
198- if ( restAPI && process . env . PROXY_ACTINIUM_API !== 'off' ) {
216+ if ( global . restAPI && process . env . PROXY_ACTINIUM_API !== 'off' ) {
199217 ReactiumBoot . Server . Middleware . register ( 'api' , {
200218 name : 'api' ,
201219 use : proxy ( '/api' , {
@@ -211,7 +229,7 @@ const registeredMiddleware = async () => {
211229 } ) ;
212230 }
213231
214- if ( restAPI && process . env . PROXY_ACTINIUM_API !== 'off' ) {
232+ if ( global . restAPI && process . env . PROXY_ACTINIUM_API !== 'off' ) {
215233 ReactiumBoot . Server . Middleware . register ( 'api-socket-io' , {
216234 name : 'api-socket-io' ,
217235 use : proxy ( '/actinium.io' , {
@@ -354,17 +372,6 @@ const registeredDevMiddleware = () => {
354372 // set app variables
355373 app . set ( 'x-powered-by' , false ) ;
356374
357- // include boot DDD artifacts
358- globby ( [
359- `${ rootPath } /.core/**/reactium-boot.js` ,
360- `${ rootPath } /src/**/reactium-boot.js` ,
361- `${ rootPath } /reactium_modules/**/reactium-boot.js` ,
362- `${ rootPath } /node_modules/**/reactium-plugin/**/reactium-boot.js` ,
363- ] ) . map ( item => {
364- const p = path . normalize ( item ) ;
365- require ( p ) ;
366- } ) ;
367-
368375 // development mode
369376 if ( process . env . NODE_ENV === 'development' ) {
370377 const webpack = require ( 'webpack' ) ;
@@ -508,6 +515,7 @@ const bootup = async () => {
508515 const logger = console ;
509516 try {
510517 await globals ( ) ;
518+ await reactiumBootHooks ( ) ;
511519 await ssrStartup ( ) ;
512520 await apiConfig ( ) ;
513521 await startServer ( ) ;
0 commit comments