Skip to content

Commit 6a8c5f4

Browse files
authored
FCE-2017 / remove fishjam url (#199)
## Description Removes fishjam url property. ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
1 parent 7325ea3 commit 6a8c5f4

10 files changed

Lines changed: 17 additions & 27 deletions

File tree

.github/workflows/build-and-test-room-manager-amd64.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
--name gh-runner-room-manager \
4141
--restart always \
4242
-e PORT=8080 \
43-
-e FISHJAM_URL=${{ vars.ROOM_MANAGER_FISHJAM_URL }} \
43+
-e FISHJAM_ID=${{ vars.ROOM_MANAGER_FISHJAM_URL }} \
4444
-e FISHJAM_MANAGEMENT_TOKEN=${{ vars.ROOM_MANAGER_FISHJAM_SERVER_TOKEN }} \
4545
room-manager:${{ github.event.pull_request.head.sha }}
4646
- name: Test Room Manager Healtcheck

examples/room-manager/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1+
FISHJAM_ID=Fishjam ID
12
FISHJAM_MANAGEMENT_TOKEN=Admin secret token
2-
FISHJAM_URL=App url

examples/room-manager/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ We recommend using the provided Room Manger instance on [fishjam.io](https://fis
2525
docker build -t room-manager -f examples/room-manager/Dockerfile .
2626
```
2727

28-
2. Run the following command with `{url}` and `{token}` placeholders replaced to start the Room Manager:
28+
2. Run the following command with `{fishjam_id}` and `{token}` placeholders replaced to start the Room Manager:
2929

3030
```sh
31-
docker run -e FISHJAM_URL={url} -e FISHJAM_MANAGEMENT_TOKEN={token} -d -p 8000:8080 room-manager:latest
31+
docker run -e FISHJAM_ID={fishjam_id} -e FISHJAM_MANAGEMENT_TOKEN={token} -d -p 8000:8080 room-manager:latest
3232
```
3333

3434
## API

examples/room-manager/src/config.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ declare module 'fastify' {
44
PORT: number;
55
ENABLE_SIMULCAST: boolean;
66
MAX_PEERS?: number;
7-
FISHJAM_ID?: string;
8-
FISHJAM_URL?: string;
7+
FISHJAM_ID: string;
98
FISHJAM_MANAGEMENT_TOKEN: string;
109
ROOM_VIDEO_CODEC: string;
1110
};
@@ -14,7 +13,7 @@ declare module 'fastify' {
1413

1514
export const configSchema = {
1615
type: 'object',
17-
required: ['PORT', 'ENABLE_SIMULCAST', 'FISHJAM_MANAGEMENT_TOKEN'],
16+
required: ['PORT', 'ENABLE_SIMULCAST', 'FISHJAM_ID', 'FISHJAM_MANAGEMENT_TOKEN'],
1817
properties: {
1918
PORT: {
2019
type: 'string',
@@ -30,15 +29,9 @@ export const configSchema = {
3029
},
3130
FISHJAM_ID: {
3231
type: 'string',
33-
default: undefined,
34-
},
35-
FISHJAM_URL: {
36-
type: 'string',
37-
default: undefined,
3832
},
3933
FISHJAM_MANAGEMENT_TOKEN: {
4034
type: 'string',
41-
default: undefined,
4235
},
4336
ROOM_VIDEO_CODEC: {
4437
type: 'string',

examples/room-manager/src/plugins/fishjam.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export const fishjamPlugin = fastifyPlugin(async (fastify: FastifyInstance): Pro
3636

3737
const fishjamClient = new FishjamClient({
3838
fishjamId: fastify.config.FISHJAM_ID,
39-
fishjamUrl: fastify.config.FISHJAM_URL,
4039
managementToken: fastify.config.FISHJAM_MANAGEMENT_TOKEN,
4140
});
4241

examples/transcription/src/environment.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
declare global {
22
namespace NodeJS {
33
interface ProcessEnv {
4-
FISHJAM_ID?: string;
5-
FISHJAM_URL?: string;
4+
FISHJAM_ID: string;
65
FISHJAM_TOKEN?: string;
76
GEMINI_API_KEY?: string;
87
}

examples/transcription/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import { peerController } from './controllers/peers';
33
import { FishjamService } from './service/fishjam';
44
import { TranscriptionService } from './service/transcription';
55

6-
if (!(process.env.FISHJAM_ID || process.env.FISHJAM_URL) || !process.env.FISHJAM_TOKEN || !process.env.GEMINI_API_KEY) {
6+
if (!process.env.FISHJAM_ID || !process.env.FISHJAM_TOKEN || !process.env.GEMINI_API_KEY) {
77
throw Error('Environment variables FISHJAM_ID, FISHJAM_TOKEN and GEMINI_API_KEY are required.');
88
}
99

1010
const fishjamConfig = {
11-
fishjamUrl: process.env.FISHJAM_URL,
1211
fishjamId: process.env.FISHJAM_ID,
1312
managementToken: process.env.FISHJAM_TOKEN,
1413
};

packages/js-server-sdk/src/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { FishjamAgent, TrackId } from './agent';
77

88
/**
99
* Client class that allows to manage Rooms and Peers for a Fishjam App.
10-
* It requires the Fishjam URL and management token that can be retrieved from the Fishjam Dashboard.
10+
* It requires the Fishjam ID and management token that can be retrieved from the Fishjam Dashboard.
1111
* @category Client
1212
*/
1313
export class FishjamClient {
@@ -22,7 +22,7 @@ export class FishjamClient {
2222
* Example usage:
2323
* ```
2424
* const fishjamClient = new FishjamClient({
25-
* fishjamUrl: fastify.config.FISHJAM_URL,
25+
* fishjamId: fastify.config.FISHJAM_ID,
2626
* managementToken: fastify.config.FISHJAM_MANAGEMENT_TOKEN,
2727
* });
2828
* ```

packages/js-server-sdk/src/types.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ export type FishjamConfig = {
3030
* Fishjam ID is a unique identifier for your account and environment.
3131
* Visit https://fishjam.io/app/ to get your Fishjam ID.
3232
*/
33-
fishjamId?: string;
34-
/*
35-
* @deprecated
36-
*/
37-
fishjamUrl?: string;
33+
fishjamId: string;
3834
/*
3935
* Management token is a secret token authorizing to perform actions on your account.
4036
* Never share this token with anyone.

packages/js-server-sdk/src/utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ export const httpToWebsocket = (httpUrl: string) => {
1010
};
1111

1212
export const getFishjamUrl = (config: FishjamConfig) => {
13-
if (!config.fishjamId && !config.fishjamUrl) throw new MissingFishjamIdException();
13+
if (!config.fishjamId) throw new MissingFishjamIdException();
1414

15-
return config.fishjamUrl ?? `https://fishjam.io/api/v1/connect/${config.fishjamId}`;
15+
try {
16+
return new URL(config.fishjamId).href;
17+
} catch {
18+
return `https://fishjam.io/api/v1/connect/${config.fishjamId}`;
19+
}
1620
};
1721

1822
export type WithRoomId<T> = {

0 commit comments

Comments
 (0)