-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add possibility to define service urls in .env
We will get tired of remembering to add it to storybook args and be careful not commit the mocked services. In the future we can handle other environment variables for other purposes as well.
- Loading branch information
Showing
7 changed files
with
59 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
STORYBOOK_CLIENT_ID=bdc1d425-9117-4867-acb9-c7307ddc2e0f | ||
STORYBOOK_LIBRARY_TOKEN=e26e4ca8934475e6a9aytefb028b2e9fa846b5b8 | ||
PUBLIZON_BASEURL=http://publizon-mock.docker | ||
FBS_BASEURL=http://fbs-mock.docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const dotenv = require("dotenv"); | ||
|
||
const getEnvVariables = () => { | ||
return dotenv.config().parsed; | ||
}; | ||
const convertEnvVariablesToWebpack = (env) => | ||
Object.keys(env).reduce( | ||
(prev, next) => ({ | ||
...prev, | ||
[`process.env.${next}`]: JSON.stringify(env[next]) | ||
}), | ||
{} | ||
); | ||
|
||
exports.getWebPackEnvVariables = () => { | ||
const variables = getEnvVariables(); | ||
return variables ? convertEnvVariablesToWebpack(variables) : null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters