@@ -19,6 +19,7 @@ const DAPI_PROFILE_SERVICES = {
1919 * @param {getConnectionHost } getConnectionHost
2020 * @param {ensureFileMountExists } ensureFileMountExists
2121 * @param {HomeDir } homeDir
22+ * @param {getConfigProfiles } getConfigProfiles
2223 * @return {startNodeTask }
2324 */
2425export default function startNodeTaskFactory (
@@ -30,7 +31,19 @@ export default function startNodeTaskFactory(
3031 getConnectionHost ,
3132 ensureFileMountExists ,
3233 homeDir ,
34+ getConfigProfiles ,
3335) {
36+ function getPlatformProfiles ( config ) {
37+ const platformProfiles = getConfigProfiles ( config )
38+ . filter ( ( profile ) => profile . startsWith ( 'platform' ) ) ;
39+
40+ if ( platformProfiles . length === 0 ) {
41+ platformProfiles . push ( 'platform' ) ;
42+ }
43+
44+ return Array . from ( new Set ( platformProfiles ) ) ;
45+ }
46+
3447 /**
3548 * @typedef {startNodeTask }
3649 * @param {Config } config
@@ -89,10 +102,7 @@ export default function startNodeTaskFactory(
89102 title : 'Check node is not started' ,
90103 enabled : ( ctx ) => ! ctx . isForce ,
91104 task : async ( ctx ) => {
92- const profiles = [ ] ;
93- if ( ctx . platformOnly ) {
94- profiles . push ( 'platform' ) ;
95- }
105+ const profiles = ctx . platformOnly ? getPlatformProfiles ( config ) : [ ] ;
96106
97107 if ( await dockerCompose . isNodeRunning ( config , { profiles } ) ) {
98108 throw new Error ( 'Running services detected. Please ensure all services are stopped for this config before starting' ) ;
@@ -147,10 +157,7 @@ export default function startNodeTaskFactory(
147157 config . get ( 'core.masternode.operator.privateKey' , true ) ;
148158 }
149159
150- const profiles = [ ] ;
151- if ( ctx . platformOnly ) {
152- profiles . push ( 'platform' ) ;
153- }
160+ const profiles = ctx . platformOnly ? getPlatformProfiles ( config ) : [ ] ;
154161
155162 await dockerCompose . up ( config , { profiles } ) ;
156163 } ,
0 commit comments