openvibers/openvibe.exchange Commits

Exchange: reach Actor at openvibe.actor by default (#201)

OP OpenVibers committed 2 days ago · 26b6c16f84 · 3 files, +29 −2

Changes

ddiff --git a/server/actor.js b/server/actor.js
iindex 1be31dc..baf2904 100644
---- a/server/actor.js
++++ b/server/actor.js
@@@ -30,7 +30,7 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
function createActor({ config, fetchImpl = globalThis.fetch, log = console, now = () => Date.now() } = {}) {
const a = (config && config.actor) || {};
-- const base = trim(a.url || 'https://actor.openvibe.services');
++ const base = trim(a.url || 'https://openvibe.actor');
const timeoutMs = Math.max(2000, Number(a.timeoutMs) || 15_000);
const waitMs = Math.max(5000, Number(a.waitMs) || 90_000);
const pollMs = Math.max(500, Number(a.pollMs) || 2000);
ddiff --git a/server/config.js b/server/config.js
iindex ae84c83..b86fb38 100644
---- a/server/config.js
++++ b/server/config.js
@@@ -77,7 +77,7 @@ function load(env = process.env) {
// person — their own Bearer on the wire, their allowance. The wait bounds one page POST; a turn still
// running then is reconciled on the next view.
actor: {
-- url: trim(env.OV_ACTOR_URL || 'https://actor.openvibe.services'),
++ url: trim(env.OV_ACTOR_URL || 'https://openvibe.actor'),
timeoutMs: Math.max(2000, int(env.EXCHANGE_ACTOR_TIMEOUT_MS, 15_000)),
waitMs: Math.max(5000, int(env.EXCHANGE_ACTOR_WAIT_MS, 90_000)),
pollMs: Math.max(500, int(env.EXCHANGE_ACTOR_POLL_MS, 2000)),
ddiff --git a/test/actor-url.test.js b/test/actor-url.test.js
nnew file mode 100644
iindex 0000000..9f8094e
---- /dev/null
++++ b/test/actor-url.test.js
@@@ -0,0 +1,27 @@
++'use strict';
++/**
++ * OpenVibe.Actor's address (one-engine slice): the public base is openvibe.actor. A server with no OV_ACTOR_URL
++ * must reach Actor there, not at a host that does not resolve — a production companion turn failed on that.
++ */
++const assert = require('assert');
++const { check, done } = require('./helpers/boot');
++const configLib = require('../server/config');
++const { createActor } = require('../server/actor');
++
++(async () => {
++ await check('the config default is the public Actor base', async () => {
++ assert.strictEqual(configLib.load({}).actor.url, 'https://openvibe.actor');
++ });
++
++ await check('a client with no actor config still calls openvibe.actor', async () => {
++ let called = null;
++ const actor = createActor({
++ config: {},
++ fetchImpl: async (url) => { called = String(url); throw new Error('offline'); },
++ });
++ await assert.rejects(() => actor.turn({ token: 'test-token', task: 'hello', budgetUsd: 0.01 }), /could not be reached/);
++ assert.ok(called && called.startsWith('https://openvibe.actor/api/v1/tasks'), called);
++ });
++
++ done();
++})();