@@ -3,61 +3,63 @@ import { pathExists } from 'fs-extra';
33import { runLocalCommand } from '../runner.js' ;
44import { ui } from '../ui.js' ;
55import { loadConfig } from '../../config/loader.js' ;
6+ import { getActiveApp } from '../../domain/workspace.js' ;
67
78export async function cmdConfigShow ( cwd : string , options : { config ?: string } ) : Promise < void > {
89 await runLocalCommand (
910 cwd ,
1011 async ( config ) => {
12+ const app = getActiveApp ( config ) ;
1113 ui . heading ( 'Shipnode Configuration' ) ;
1214
1315 ui . section ( 'App' , [
14- [ 'app' , config . app ] ,
16+ [ 'app' , app . appType ] ,
1517 [ 'nodeVersion' , config . nodeVersion ] ,
16- [ 'envFile' , config . envFile ] ,
17- [ 'keepReleases' , String ( config . keepReleases ) ] ,
18+ [ 'envFile' , app . envFile ] ,
19+ [ 'keepReleases' , String ( app . keepReleases ) ] ,
1820 ] ) ;
1921
2022 ui . section ( 'SSH' , [
2123 [ 'ssh' , `${ config . ssh . user } @${ config . ssh . host } :${ config . ssh . port } ` ] ,
2224 [ 'remotePath' , config . remotePath ] ,
2325 ] ) ;
2426
25- if ( config . pm2 ) {
26- for ( const app of config . pm2 . apps ) {
27- const rows : [ string , string ] [ ] = [ [ 'name' , app . name ] ] ;
28- if ( app . command ) rows . push ( [ 'command' , app . command ] ) ;
29- if ( app . port !== undefined ) rows . push ( [ 'port' , String ( app . port ) ] ) ;
30- if ( app . instances !== undefined ) rows . push ( [ 'instances' , String ( app . instances ) ] ) ;
31- if ( app . maxMemory !== undefined ) rows . push ( [ 'maxMemory' , app . maxMemory ] ) ;
32- if ( app . env ) {
33- for ( const [ k , v ] of Object . entries ( app . env ) ) rows . push ( [ `env.${ k } ` , v ] ) ;
27+ if ( app . pm2 ) {
28+ for ( const pm2App of app . pm2 . apps ) {
29+ const rows : [ string , string ] [ ] = [ [ 'name' , pm2App . name ] ] ;
30+ if ( pm2App . command ) rows . push ( [ 'command' , pm2App . command ] ) ;
31+ if ( pm2App . port !== undefined ) rows . push ( [ 'port' , String ( pm2App . port ) ] ) ;
32+ if ( pm2App . instances !== undefined ) rows . push ( [ 'instances' , String ( pm2App . instances ) ] ) ;
33+ if ( pm2App . maxMemory !== undefined ) rows . push ( [ 'maxMemory' , pm2App . maxMemory ] ) ;
34+ if ( pm2App . env ) {
35+ for ( const [ k , v ] of Object . entries ( pm2App . env ) ) rows . push ( [ `env.${ k } ` , v ] ) ;
3436 }
35- ui . section ( app . port !== undefined ? `PM2 app: ${ app . name } (web)` : `PM2 app: ${ app . name } ` , rows ) ;
37+ ui . section ( pm2App . port !== undefined ? `PM2 app: ${ pm2App . name } (web)` : `PM2 app: ${ pm2App . name } ` , rows ) ;
3638 }
3739 }
3840
39- if ( config . domain ) {
41+ if ( app . domain ) {
4042 ui . section ( 'Domain' , [
41- [ 'domain' , config . domain ] ,
43+ [ 'domain' , app . domain ] ,
4244 ] ) ;
4345 }
4446
45- if ( config . app === 'backend' ) {
47+ if ( app . appType === 'backend' ) {
4648 ui . section ( 'Health Check' , [
47- [ 'enabled' , String ( config . healthCheck . enabled ) ] ,
48- [ 'path' , config . healthCheck . path ] ,
49- [ 'timeout' , String ( config . healthCheck . timeout ) ] ,
50- [ 'retries' , String ( config . healthCheck . retries ) ] ,
51- [ 'startupDelay' , String ( config . healthCheck . startupDelay ) ] ,
49+ [ 'enabled' , String ( app . healthCheck . enabled ) ] ,
50+ [ 'path' , app . healthCheck . path ] ,
51+ [ 'timeout' , String ( app . healthCheck . timeout ) ] ,
52+ [ 'retries' , String ( app . healthCheck . retries ) ] ,
53+ [ 'startupDelay' , String ( app . healthCheck . startupDelay ) ] ,
5254 ] ) ;
5355 }
5456
55- if ( config . sharedDirs && config . sharedDirs . length > 0 ) {
56- ui . section ( 'Shared Dirs' , config . sharedDirs . map ( ( d , i ) => [ `[${ i } ]` , d ] ) ) ;
57+ if ( app . sharedDirs && app . sharedDirs . length > 0 ) {
58+ ui . section ( 'Shared Dirs' , app . sharedDirs . map ( ( d , i ) => [ `[${ i } ]` , d ] ) ) ;
5759 }
5860
59- if ( config . sharedFiles && config . sharedFiles . length > 0 ) {
60- ui . section ( 'Shared Files' , config . sharedFiles . map ( ( f , i ) => [ `[${ i } ]` , f ] ) ) ;
61+ if ( app . sharedFiles && app . sharedFiles . length > 0 ) {
62+ ui . section ( 'Shared Files' , app . sharedFiles . map ( ( f , i ) => [ `[${ i } ]` , f ] ) ) ;
6163 }
6264
6365 if ( config . database ) {
0 commit comments