Skip to content

Commit 0b0dec3

Browse files
authored
Merge pull request #4 from DogeOS69/fix_prep_charts
fix cli bug
2 parents a9c0831 + 96b1b9f commit 0b0dec3

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

src/commands/setup/gen-keystore.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,14 @@ export default class SetupGenKeystore extends Command {
5252
}
5353

5454
private async generateSequencerKeystore(index: number): Promise<SequencerData> {
55-
const password = await input({ message: `Enter a password for sequencer-${index} keystore:` })
55+
let password = ''
56+
while (!password) {
57+
password = await input({ message: `Enter a password for sequencer-${index} keystore:` })
58+
if (!password) {
59+
console.log('Password cannot be empty. Please try again.')
60+
}
61+
}
62+
5663
const wallet = Wallet.createRandom()
5764
const encryptedJson = await wallet.encrypt(password)
5865
return {

src/commands/setup/prep-charts.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ export default class SetupPrepCharts extends Command {
138138
if (configMapData && typeof configMapData === 'object' && 'data' in configMapData) {
139139
const envData = (configMapData as any).data
140140
for (const [key, value] of Object.entries(envData)) {
141-
if (value === '' || value === '[""]' || value === '[]' ||
142-
(Array.isArray(value) && (value.length === 0 || (value.length === 1 && value[0] === ''))) ||
143-
value === null || value === undefined) {
141+
// if (value === '' || value === '[""]' || value === '[]' ||
142+
// (Array.isArray(value) && (value.length === 0 || (value.length === 1 && value[0] === ''))) ||
143+
// value === null || value === undefined) {
144144
const configMapping = this.configMapping[key]
145145
if (configMapping) {
146146
let configKey: string
@@ -157,14 +157,20 @@ export default class SetupPrepCharts extends Command {
157157
} else {
158158
newValue = String(configValue)
159159
}
160-
changes.push({ key, oldValue: JSON.stringify(value), newValue: newValue })
161-
envData[key] = newValue
162-
updated = true
160+
161+
if(chartName === "l1-devnet" && key === "CHAIN_ID"){
162+
continue;
163+
}
164+
if (newValue != value) {
165+
changes.push({ key, oldValue: JSON.stringify(value), newValue: newValue })
166+
envData[key] = newValue
167+
updated = true
168+
}
163169
} else {
164170
this.log(chalk.yellow(`${chartName}: No value found for ${configKey}`))
165171
}
166172
}
167-
}
173+
//}
168174
}
169175
}
170176
}

src/commands/setup/push-secrets.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export default class SetupPushSecrets extends Command {
369369
}
370370
}
371371

372-
private async updateProductionYaml(provider: string): Promise<void> {
372+
private async updateProductionYaml(provider: string, prefixName?: string): Promise<void> {
373373
const valuesDir = path.join(process.cwd(), this.flags['values-dir']);
374374
if (!fs.existsSync(valuesDir)) {
375375
this.error(chalk.red(`Values directory not found at ${valuesDir}`));
@@ -432,17 +432,19 @@ export default class SetupPushSecrets extends Command {
432432
}
433433

434434
// Update remoteRef for l2-sequencer secrets
435-
if (secretName.match(/^l2-sequencer-\d+-secret$/)) {
435+
if (secretName.match(/^l2-sequencer-secret-\d+-env$/)) {
436436
for (const data of secret.data) {
437437
if (data.remoteRef && data.remoteRef.key) {
438-
data.remoteRef.key = 'l2-sequencer-secret';
438+
// Use the prefixName if available
439+
const prefix = prefixName || (data.remoteRef.key.startsWith('scroll/') ? 'scroll' : '');
440+
data.remoteRef.key = `${prefix}/l2-sequencer-secret-env`;
439441
updated = true;
440442
}
441443
}
442444
}
443445
}
444446
}
445-
447+
446448
if (updated) {
447449
const newContent = yaml.dump(yamlContent, { lineWidth: -1, noRefs: true, quotingType: '"', forceQuotes: true });
448450
fs.writeFileSync(yamlPath, newContent);
@@ -470,11 +472,13 @@ export default class SetupPushSecrets extends Command {
470472

471473
let service: SecretService
472474
let provider: string
475+
let prefixName: string | undefined
473476

474477
if (secretService === 'aws') {
475478
const awsCredentials = await this.getAWSCredentials()
476479
service = new AWSSecretService(awsCredentials.secretRegion, awsCredentials.prefixName, flags.debug)
477480
provider = 'aws'
481+
prefixName = awsCredentials.prefixName
478482
} else if (secretService === 'vault') {
479483
service = new HashicorpVaultDevService(flags.debug)
480484
provider = 'vault'
@@ -491,7 +495,7 @@ export default class SetupPushSecrets extends Command {
491495
})
492496

493497
if (shouldUpdateYaml) {
494-
await this.updateProductionYaml(provider)
498+
await this.updateProductionYaml(provider, prefixName)
495499
this.log(chalk.green('Production YAML files updated successfully'))
496500
} else {
497501
this.log(chalk.yellow('Skipped updating production YAML files'))

0 commit comments

Comments
 (0)