openvibers/openvibe.exchange Commits
Exchange: reach Actor at openvibe.actor by default (#201)
Changes
@@@ -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);@@@ -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)),nnew file mode 100644@@@ -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();++})();
@@ -30,7 +30,7 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
@@ -30,7 +30,7 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
function createActor({ config, fetchImpl = globalThis.fetch, log = console, now = () => Date.now() } = {}) {
function createActor({ config, fetchImpl = globalThis.fetch, log = console, now = () => Date.now() } = {}) {
const a = (config && config.actor) || {};
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 timeoutMs = Math.max(2000, Number(a.timeoutMs) || 15_000);
const waitMs = Math.max(5000, Number(a.waitMs) || 90_000);
const waitMs = Math.max(5000, Number(a.waitMs) || 90_000);
const pollMs = Math.max(500, Number(a.pollMs) || 2000);
const pollMs = Math.max(500, Number(a.pollMs) || 2000);
@@ -77,7 +77,7 @@ function load(env = process.env) {
@@ -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
// 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.
// running then is reconciled on the next view.
actor: {
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)),
timeoutMs: Math.max(2000, int(env.EXCHANGE_ACTOR_TIMEOUT_MS, 15_000)),
waitMs: Math.max(5000, int(env.EXCHANGE_ACTOR_WAIT_MS, 90_000)),
waitMs: Math.max(5000, int(env.EXCHANGE_ACTOR_WAIT_MS, 90_000)),
pollMs: Math.max(500, int(env.EXCHANGE_ACTOR_POLL_MS, 2000)),
pollMs: Math.max(500, int(env.EXCHANGE_ACTOR_POLL_MS, 2000)),
new file mode 100644
new file mode 100644
@@ -0,0 +1,27 @@
@@ -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();
+})();