From 26f7e3f3cb8e9875b01e7c08a691ff3ffcc1e1f4 Mon Sep 17 00:00:00 2001 From: Tanu Chahal <117712672+tanu-chahal@users.noreply.github.com> Date: Wed, 25 Oct 2023 21:20:41 +0530 Subject: [PATCH] Fix/#265 added RC_HOST as env variable (#289) --- README.md | 6 ++++++ packages/react/src/index.js | 2 +- packages/react/src/stories/EmbeddedChat.stories.js | 2 +- packages/react/src/stories/EmbeddedChatAuthToken.stories.js | 2 +- packages/react/src/stories/EmbeddedChatTheme.stories.js | 2 +- .../react/src/stories/EmbeddedChatWithoutHeader.stories.js | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f614c2252..70eaa59e8 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,12 @@ yarn storybook Till now, storybook should be up and running. You can play around with EmbeddedChat and it's component and see changes in storybook in real-time. +By default, the Rocket Chat server host is http://localhost:3000, in case you have Rocket Chat server running on any other port/server you can try set up custom url as ```STORYBOOK_RC_HOST=``` variable by creating a ``.env`` file in ```packages/react``` directory or simply run this commmand in ```packages/react```: + +```bash +STORYBOOK_RC_HOST= yarn storybook +``` + ### Working with api and auth packages. #### Starting auth dev environment diff --git a/packages/react/src/index.js b/packages/react/src/index.js index b75b5e770..68313c131 100644 --- a/packages/react/src/index.js +++ b/packages/react/src/index.js @@ -20,7 +20,7 @@ export const EmbeddedChat = ({ moreOpts = false, width = '100%', height = '50vh', - host = 'http://localhost:3000', + host = process.env.STORYBOOK_RC_HOST || 'http://localhost:3000', roomId = 'GENERAL', channelName, anonymousMode = false, diff --git a/packages/react/src/stories/EmbeddedChat.stories.js b/packages/react/src/stories/EmbeddedChat.stories.js index 3b186c114..bdf8e3d6b 100644 --- a/packages/react/src/stories/EmbeddedChat.stories.js +++ b/packages/react/src/stories/EmbeddedChat.stories.js @@ -9,7 +9,7 @@ export default { // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args export const Simple = { args: { - host: 'http://localhost:3000', + host: process.env.STORYBOOK_RC_HOST || 'http://localhost:3000', roomId: 'GENERAL', GOOGLE_CLIENT_ID: '', isClosable: true, diff --git a/packages/react/src/stories/EmbeddedChatAuthToken.stories.js b/packages/react/src/stories/EmbeddedChatAuthToken.stories.js index 68516a47e..972f3b16b 100644 --- a/packages/react/src/stories/EmbeddedChatAuthToken.stories.js +++ b/packages/react/src/stories/EmbeddedChatAuthToken.stories.js @@ -9,7 +9,7 @@ export default { // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args export const Simple = { args: { - host: 'http://localhost:3000', + host: process.env.STORYBOOK_RC_HOST || 'http://localhost:3000', roomId: 'GENERAL', GOOGLE_CLIENT_ID: '', isClosable: true, diff --git a/packages/react/src/stories/EmbeddedChatTheme.stories.js b/packages/react/src/stories/EmbeddedChatTheme.stories.js index 2e5978839..d3dabb1da 100644 --- a/packages/react/src/stories/EmbeddedChatTheme.stories.js +++ b/packages/react/src/stories/EmbeddedChatTheme.stories.js @@ -9,7 +9,7 @@ export default { // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args export const WithTheme = { args: { - host: 'http://localhost:3000', + host: process.env.STORYBOOK_RC_HOST || 'http://localhost:3000', roomId: 'GENERAL', GOOGLE_CLIENT_ID: '', isClosable: true, diff --git a/packages/react/src/stories/EmbeddedChatWithoutHeader.stories.js b/packages/react/src/stories/EmbeddedChatWithoutHeader.stories.js index 22ffcb0a2..636036e5d 100644 --- a/packages/react/src/stories/EmbeddedChatWithoutHeader.stories.js +++ b/packages/react/src/stories/EmbeddedChatWithoutHeader.stories.js @@ -9,7 +9,7 @@ export default { // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args export const Simple = { args: { - host: 'http://localhost:3000', + host: process.env.STORYBOOK_RC_HOST || 'http://localhost:3000', roomId: 'GENERAL', GOOGLE_CLIENT_ID: '', isClosable: true,