Skip to content

Commit 5e686f3

Browse files
committed
env for build configuration
1 parent d60c3c2 commit 5e686f3

File tree

6 files changed

+43
-9
lines changed

6 files changed

+43
-9
lines changed

.envrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ export NODE_VERSIONS=~/.nvm/versions/node
55
export NODE_VERSION_PREFIX='v'
66
export NODE_OPTIONS=--openssl-legacy-provider
77
use node # reads .node-version, keep in sync with package.json
8+
9+
# Custom env values go into .envrc.local
10+
if [ -f .envrc.local ]; then
11+
echo "loading .envrc.local"
12+
source_env .envrc.local
13+
fi
14+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ yarn-error.log
2929
.cache-loader
3030

3131
# Misc
32+
.envrc.local
3233
.env.local
3334
.env.development.local
3435
.env.test.local

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ $ npm run build
3030

3131
This command generates static content into the `build` directory and can be served using any static contents hosting service.
3232

33+
### Environment Variables
34+
35+
In order to deploy to multiple environments, some configuration options in `docusaurus.config.ts` are made available for override through environment variables.
36+
37+
```bash
38+
# Can be replaced by your GH pages url, ie. https://<userId>.github.io/
39+
CADENCE_DOCS_URL=https://cadenceworkflow.io
40+
41+
# For GitHub pages deployment, it is often /<projectName>/ defaults to `/`
42+
CADENCE_DOCS_BASE_URL=/cadence-docs/
43+
44+
# For Github pages only, this is your Github org/user name.
45+
CADENCE_DOCS_ORGANIZATION=cadence-workflow
46+
```
47+
3348
### Deployment
3449

3550
Using SSH:

docusaurus.config.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { Options as BlogOptions } from '@docusaurus/plugin-content-blog';
1111
import type { Options as PageOptions } from '@docusaurus/plugin-content-pages';
1212
import type { Options as IdealImageOptions } from '@docusaurus/plugin-ideal-image';
1313
import type { Options as ClientRedirectsOptions } from '@docusaurus/plugin-client-redirects';
14-
14+
import { envReplace } from '@pnpm/config.env-replace';
1515

1616
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
1717
const defaultLocale = 'en';
@@ -21,15 +21,16 @@ const config: Config = {
2121
tagline: 'Orchestrate with Confidence: The Open-Source Workflow Engine for Tomorrow',
2222
favicon: 'img/favicon.ico',
2323

24-
url: 'https://cadenceworkflow.io/',
24+
url: envReplace('${CADENCE_DOCS_URL:-https://cadenceworkflow.io}', process.env),
25+
2526
// Set the /<baseUrl>/ pathname under which your site is served
2627
// For GitHub pages deployment, it is often '/<projectName>/'
27-
baseUrl: '/',
28+
baseUrl: envReplace('${CADENCE_DOCS_BASE_URL:-/}', process.env),
2829

2930
// GitHub pages deployment config.
3031
// If you aren't using GitHub pages, you don't need these.
31-
organizationName: 'cadence-workflow', // Usually your GitHub org/user name.
32-
projectName: 'cadence-Docs', // Usually your repo name.
32+
organizationName: envReplace('${CADENCE_DOCS_ORGANIZATION:-cadence-workflow}', process.env),
33+
projectName: 'cadence-docs', // Usually your repo name.
3334

3435
onBrokenLinks: 'throw',
3536
onBrokenMarkdownLinks: 'warn',

package-lock.json

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@docusaurus/remark-plugin-npm2yarn": "^3.6.3",
2828
"@docusaurus/theme-search-algolia": "^3.6.3",
2929
"@mdx-js/react": "^3.0.0",
30+
"@pnpm/config.env-replace": "^3.0.0",
3031
"clsx": "^2.0.0",
3132
"prism-react-renderer": "^2.3.0",
3233
"react": "^18.0.0",

0 commit comments

Comments
 (0)