@@ -112,7 +112,7 @@ export default class SetupConfigs extends Command {
112112 const config = toml . parse ( configContent )
113113
114114 const services = [
115- 'admin-system-backend' , 'blockscout' , 'bridge-history-api' , 'bridge-history-fetcher' , 'chain-monitor' , 'coordinator-api' , 'coordinator-cron' ,
115+ 'admin-system-backend' , 'admin-system-cron' , ' blockscout', 'bridge-history-api' , 'bridge-history-fetcher' , 'chain-monitor' , 'coordinator-api' , 'coordinator-cron' ,
116116 'gas-oracle' , 'l1-explorer' , 'l2-sequencer' , 'rollup-node'
117117 ]
118118
@@ -132,7 +132,8 @@ export default class SetupConfigs extends Command {
132132 // TODO: check privatekey secrets once integrated
133133 private generateEnvContent ( service : string , config : any ) : { [ key : string ] : string } {
134134 const mapping : Record < string , string [ ] > = {
135- 'admin-system-backend' : [ 'ADMIN_SYSTEM_BACKEND_DB_CONNECTION_STRING:SCROLL_ADMIN_AUTH_DB_CONFIG' , 'ADMIN_SYSTEM_BACKEND_DB_CONNECTION_STRING:SCROLL_ADMIN_DB_CONFIG_DSN' , 'ADMIN_SYSTEM_BACKEND_DB_CONNECTION_STRING:SCROLL_ADMION_READ_ONLY_DB_CONFIG_DSN' ] ,
135+ 'admin-system-backend' : [ 'ADMIN_SYSTEM_BACKEND_DB_CONNECTION_STRING:SCROLL_ADMIN_AUTH_DB_CONFIG_DSN' , 'ADMIN_SYSTEM_BACKEND_DB_CONNECTION_STRING:SCROLL_ADMIN_DB_CONFIG_DSN' , 'ADMIN_SYSTEM_BACKEND_DB_CONNECTION_STRING:SCROLL_ADMIN_READ_ONLY_DB_CONFIG_DSN' ] ,
136+ 'admin-system-cron' : [ 'ADMIN_SYSTEM_BACKEND_DB_CONNECTION_STRING:SCROLL_ADMIN_AUTH_DB_CONFIG_DSN' , 'ADMIN_SYSTEM_BACKEND_DB_CONNECTION_STRING:SCROLL_ADMIN_DB_CONFIG_DSN' , 'ADMIN_SYSTEM_BACKEND_DB_CONNECTION_STRING:SCROLL_ADMIN_READ_ONLY_DB_CONFIG_DSN' ] ,
136137 'blockscout' : [ 'BLOCKSCOUT_DB_CONNECTION_STRING:DATABASE_URL' ] ,
137138 'bridge-history-api' : [ 'BRIDGE_HISTORY_DB_CONNECTION_STRING:SCROLL_BRIDGE_HISTORY_DB_DSN' ] ,
138139 'bridge-history-fetcher' : [ 'BRIDGE_HISTORY_DB_CONNECTION_STRING:SCROLL_BRIDGE_HISTORY_DB_DSN' ] ,
@@ -482,39 +483,29 @@ export default class SetupConfigs extends Command {
482483 }
483484
484485 const fileMappings = [
485- { source : 'admin-system-backend-config.yaml' , target : 'admin-system-backend-config.yaml' , prefix : 'admin-system-backend:' } ,
486- { source : 'admin-system-backend-config.yaml' , target : 'admin-system-cron-config.yaml' , prefix : 'admin-system-cron:' } ,
487- { source : 'balance-checker-config.yaml' , target : 'balance-checker-config.yaml' , prefix : 'balance-checker:' } ,
488- { source : 'bridge-history-config.yaml' , target : 'bridge-history-api-config.yaml' , prefix : 'bridge-history-api:' } ,
489- { source : 'bridge-history-config.yaml' , target : 'bridge-history-fetcher-config.yaml' , prefix : 'bridge-history-fetcher:' } ,
490- { source : 'chain-monitor-config.yaml' , target : 'chain-monitor-config.yaml' , prefix : 'chain-monitor:' } ,
491- { source : 'coordinator-config.yaml' , target : 'coordinator-api-config.yaml' , prefix : 'coordinator-api:' } ,
492- { source : 'coordinator-config.yaml' , target : 'coordinator-cron-config.yaml' , prefix : 'coordinator-cron:' } ,
493- { source : 'frontend-config.yaml' , target : 'frontends-config.yaml' , prefix : 'frontends:' } ,
494- { source : 'genesis.yaml' , target : 'genesis.yaml' , prefix : 'scroll-common:' } ,
495- { source : 'rollup-config.yaml' , target : 'gas-oracle-config.yaml' , prefix : 'gas-oracle:' } ,
496- { source : 'rollup-config.yaml' , target : 'rollup-node-config.yaml' , prefix : 'rollup-node:' } ,
497- { source : 'rollup-explorer-backend-config.yaml' , target : 'rollup-explorer-backend-config.yaml' , prefix : 'rollup-explorer-backend:' } ,
486+ { source : 'admin-system-backend-config.yaml' , target : 'admin-system-backend-config.yaml' } ,
487+ { source : 'admin-system-backend-config.yaml' , target : 'admin-system-cron-config.yaml' } ,
488+ { source : 'balance-checker-config.yaml' , target : 'balance-checker-config.yaml' } ,
489+ { source : 'bridge-history-config.yaml' , target : 'bridge-history-api-config.yaml' } ,
490+ { source : 'bridge-history-config.yaml' , target : 'bridge-history-fetcher-config.yaml' } ,
491+ { source : 'chain-monitor-config.yaml' , target : 'chain-monitor-config.yaml' } ,
492+ { source : 'coordinator-config.yaml' , target : 'coordinator-api-config.yaml' } ,
493+ { source : 'coordinator-config.yaml' , target : 'coordinator-cron-config.yaml' } ,
494+ { source : 'frontend-config.yaml' , target : 'frontends-config.yaml' } ,
495+ { source : 'genesis.yaml' , target : 'genesis.yaml' } ,
496+ { source : 'rollup-config.yaml' , target : 'gas-oracle-config.yaml' } ,
497+ { source : 'rollup-config.yaml' , target : 'rollup-node-config.yaml' } ,
498+ { source : 'rollup-explorer-backend-config.yaml' , target : 'rollup-explorer-backend-config.yaml' } ,
498499 ] ;
499500
500- // Read all source files first
501- const sourceFiles = new Map < string , string > ( ) ;
501+ // Process all mappings
502502 for ( const mapping of fileMappings ) {
503503 const sourcePath = path . join ( sourceDir , mapping . source ) ;
504- if ( fs . existsSync ( sourcePath ) && ! sourceFiles . has ( mapping . source ) ) {
505- sourceFiles . set ( mapping . source , fs . readFileSync ( sourcePath , 'utf8' ) ) ;
506- }
507- }
504+ const targetPath = path . join ( targetDir , mapping . target ) ;
508505
509- // Process all mappings
510- for ( const mapping of fileMappings ) {
511- const content = sourceFiles . get ( mapping . source ) ;
512- if ( content ) {
513- const targetPath = path . join ( targetDir , mapping . target ) ;
506+ if ( fs . existsSync ( sourcePath ) ) {
514507 try {
515- const indentedContent = content . split ( '\n' ) . map ( line => ` ${ line } ` ) . join ( '\n' ) ;
516- const newContent = `${ mapping . prefix } \n${ indentedContent } ` ;
517- fs . writeFileSync ( targetPath , newContent ) ;
508+ fs . copyFileSync ( sourcePath , targetPath ) ;
518509 this . log ( chalk . green ( `Processed file: ${ mapping . source } -> ${ mapping . target } ` ) ) ;
519510 } catch ( error : unknown ) {
520511 if ( error instanceof Error ) {
@@ -529,16 +520,18 @@ export default class SetupConfigs extends Command {
529520 }
530521
531522 // Remove source files after all processing is complete
532- for ( const sourceFile of sourceFiles . keys ( ) ) {
533- const sourcePath = path . join ( sourceDir , sourceFile ) ;
534- try {
535- fs . unlinkSync ( sourcePath ) ;
536- this . log ( chalk . green ( `Removed source file: ${ sourceFile } ` ) ) ;
537- } catch ( error : unknown ) {
538- if ( error instanceof Error ) {
539- this . log ( chalk . red ( `Error removing file ${ sourceFile } : ${ error . message } ` ) ) ;
540- } else {
541- this . log ( chalk . red ( `Unknown error removing file ${ sourceFile } ` ) ) ;
523+ for ( const mapping of fileMappings ) {
524+ const sourcePath = path . join ( sourceDir , mapping . source ) ;
525+ if ( fs . existsSync ( sourcePath ) ) {
526+ try {
527+ fs . unlinkSync ( sourcePath ) ;
528+ this . log ( chalk . green ( `Removed source file: ${ mapping . source } ` ) ) ;
529+ } catch ( error : unknown ) {
530+ if ( error instanceof Error ) {
531+ this . log ( chalk . red ( `Error removing file ${ mapping . source } : ${ error . message } ` ) ) ;
532+ } else {
533+ this . log ( chalk . red ( `Unknown error removing file ${ mapping . source } ` ) ) ;
534+ }
542535 }
543536 }
544537 }
@@ -556,9 +549,7 @@ export default class SetupConfigs extends Command {
556549 if ( fs . existsSync ( sourcePath ) ) {
557550 const content = fs . readFileSync ( sourcePath , 'utf8' ) ;
558551 const yamlContent = {
559- contracts : {
560- [ file . key ] : content ,
561- } ,
552+ [ file . key ] : content ,
562553 } ;
563554 const yamlString = yaml . dump ( yamlContent , { indent : 2 } ) ;
564555 fs . writeFileSync ( targetPath , yamlString ) ;
0 commit comments