Read node config from env vars for WASM tests

This commit is contained in:
Brandon Vandegrift 2025-07-06 22:00:04 -04:00 committed by Christien Rioux
parent 67be63c91c
commit 000dcf823f
2 changed files with 10 additions and 1 deletions

View file

@ -103,7 +103,7 @@ describe('VeilidRoutingContext', () => {
const bestCryptoKind = veilidCrypto.bestCryptoKind();
const ownerKeyPair = veilidCrypto.generateKeyPair(bestCryptoKind);
const [owner, secret] = ownerKeyPair.split(':');
const dhtRecordKey = await routingContext.getDhtRecordKey({ kind: 'DFLT', o_cnt: 1 }, `${bestCryptoKind}:owner`);
const dhtRecordKey = await routingContext.getDhtRecordKey({ kind: 'DFLT', o_cnt: 1 }, `${bestCryptoKind}:${owner}`);
const dhtRecord = await routingContext.createDhtRecord({ kind: 'DFLT', o_cnt: 1 }, ownerKeyPair, bestCryptoKind);
expect(dhtRecord.key).toBeDefined();
expect(dhtRecord.key).toEqual(dhtRecordKey);

View file

@ -21,6 +21,15 @@ export const veilidCoreInitConfig: VeilidWASMConfig = {
export var veilidCoreStartupConfig = (() => {
var defaultConfig = veilidClient.defaultConfig();
defaultConfig.program_name = 'veilid-wasm-test';
if(process.env.NETWORK_KEY) {
defaultConfig.network.network_key_password = process.env.NETWORK_KEY;
}
if(process.env.BOOTSTRAP_KEYS) {
defaultConfig.network.routing_table.bootstrap_keys = process.env.BOOTSTRAP_KEYS.split(',') as `${string}:${string}`[];
}
if(process.env.BOOTSTRAP) {
defaultConfig.network.routing_table.bootstrap = process.env.BOOTSTRAP.split(',');
}
// Ensure we are starting from scratch
defaultConfig.table_store.delete = true;
defaultConfig.protected_store.delete = true;