2021-04-28 11:11:39 +02:00
|
|
|
import { Config } from 'crdt-meta';
|
2021-02-08 18:31:29 +01:00
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
if (process.argv[2] === undefined) {
|
|
|
|
process.stderr.write('Usage: node dumpConfig.js <configdir>\n');
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
const stat = fs.statSync(process.argv[2]);
|
|
|
|
if (!stat.isDirectory()) {
|
|
|
|
throw 'not a directory';
|
|
|
|
}
|
|
|
|
} catch {
|
|
|
|
process.stderr.write('Not a directory: ' + process.argv[2] + '\n');
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
2021-04-28 11:11:39 +02:00
|
|
|
const c = new Config(process.argv[2], process.env['CONFINI_ENV_PREFIX']);
|
2021-02-08 18:31:29 +01:00
|
|
|
c.process();
|
|
|
|
process.stdout.write(c.toString());
|