Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 54s
CI/CD Pipeline / Security Scanning (push) Successful in 2m25s
CI/CD Pipeline / Lint and Format (push) Failing after 44s
CI/CD Pipeline / Terraform Validation (push) Failing after 23s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 25s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 39s
Validation / validate-genesis (push) Successful in 28s
Validation / validate-terraform (push) Failing after 26s
Validation / validate-kubernetes (push) Failing after 10s
Validation / validate-smart-contracts (push) Failing after 10s
Validation / validate-security (push) Failing after 1m13s
Validation / validate-documentation (push) Failing after 17s
Verify Deployment / Verify Deployment (push) Failing after 53s
Support configurable Fineract headroom adjustment JSON paths and a helper to emit mint/RPC/bitcoind keys for secure.omdnl.org deploy without printing secrets. Co-authored-by: Cursor <cursoragent@cursor.com>
57 lines
1.7 KiB
JavaScript
57 lines
1.7 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Merge mint/RPC/bitcoind keys from repo .env into production env fragment (no stdout secrets).
|
|
*
|
|
* node scripts/deployment/sync-production-mint-env.mjs --write .env.production-mint.fragment
|
|
*/
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const repoRoot = path.resolve(__dirname, '../..');
|
|
const envFile = process.env.OMNL_BANK_ENV || path.join(repoRoot, '.env');
|
|
|
|
function parseEnv(file) {
|
|
const out = {};
|
|
if (!fs.existsSync(file)) return out;
|
|
for (const line of fs.readFileSync(file, 'utf8').split(/\r?\n/)) {
|
|
if (!line || line.startsWith('#') || !line.includes('=')) continue;
|
|
const i = line.indexOf('=');
|
|
out[line.slice(0, i).trim()] = line.slice(i + 1);
|
|
}
|
|
return out;
|
|
}
|
|
|
|
const env = parseEnv(envFile);
|
|
const keys = [
|
|
'OMNL_MINT_OPERATOR_PRIVATE_KEY',
|
|
'RPC_URL_138',
|
|
'CHAIN_138_RPC_URL',
|
|
'SETTLEMENT_ALLOW_CHAIN_MINT_EXECUTE',
|
|
'OMNL_ALLOW_CHAIN_MINT_EXECUTE',
|
|
'BITCOIND_RPC_URL',
|
|
'BITCOIND_RPC_USER',
|
|
'BITCOIND_RPC_PASS',
|
|
'BTC_NETWORK',
|
|
'BTC_CONFIRMATIONS_REQUIRED',
|
|
'OMNL_BTC_WALLET_CONFIG',
|
|
'OMNL_BTC_LEDGER_CONFIG',
|
|
'CBTC_ADDRESS_138',
|
|
'DODO_PMM_INTEGRATION',
|
|
'CHAIN138_ORACLE_URL',
|
|
];
|
|
|
|
const lines = keys
|
|
.filter((k) => env[k]?.trim())
|
|
.map((k) => `${k}=${env[k].trim()}`);
|
|
|
|
const writeArg = process.argv.indexOf('--write');
|
|
if (writeArg >= 0) {
|
|
const out = process.argv[writeArg + 1] || path.join(repoRoot, '.env.production-mint.fragment');
|
|
fs.writeFileSync(out, `${lines.join('\n')}\n`, 'utf8');
|
|
console.log(`Wrote ${lines.length} keys to ${out}`);
|
|
} else {
|
|
console.log(lines.map((l) => `${l.split('=')[0]}=***`).join('\n'));
|
|
}
|