Skip to content

Commit

Permalink
env for build configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ibarrajo committed Dec 9, 2024
1 parent d60c3c2 commit 5e686f3
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ export NODE_VERSIONS=~/.nvm/versions/node
export NODE_VERSION_PREFIX='v'
export NODE_OPTIONS=--openssl-legacy-provider
use node # reads .node-version, keep in sync with package.json

# Custom env values go into .envrc.local
if [ -f .envrc.local ]; then
echo "loading .envrc.local"
source_env .envrc.local
fi

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ yarn-error.log
.cache-loader

# Misc
.envrc.local
.env.local
.env.development.local
.env.test.local
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ $ npm run build

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

### Environment Variables

In order to deploy to multiple environments, some configuration options in `docusaurus.config.ts` are made available for override through environment variables.

```bash
# Can be replaced by your GH pages url, ie. https://<userId>.github.io/
CADENCE_DOCS_URL=https://cadenceworkflow.io

# For GitHub pages deployment, it is often /<projectName>/ defaults to `/`
CADENCE_DOCS_BASE_URL=/cadence-docs/

# For Github pages only, this is your Github org/user name.
CADENCE_DOCS_ORGANIZATION=cadence-workflow
```

### Deployment

Using SSH:
Expand Down
11 changes: 6 additions & 5 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Options as BlogOptions } from '@docusaurus/plugin-content-blog';
import type { Options as PageOptions } from '@docusaurus/plugin-content-pages';
import type { Options as IdealImageOptions } from '@docusaurus/plugin-ideal-image';
import type { Options as ClientRedirectsOptions } from '@docusaurus/plugin-client-redirects';

import { envReplace } from '@pnpm/config.env-replace';

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

url: 'https://cadenceworkflow.io/',
url: envReplace('${CADENCE_DOCS_URL:-https://cadenceworkflow.io}', process.env),

// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
baseUrl: envReplace('${CADENCE_DOCS_BASE_URL:-/}', process.env),

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

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
Expand Down
17 changes: 13 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@docusaurus/remark-plugin-npm2yarn": "^3.6.3",
"@docusaurus/theme-search-algolia": "^3.6.3",
"@mdx-js/react": "^3.0.0",
"@pnpm/config.env-replace": "^3.0.0",
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
Expand Down

0 comments on commit 5e686f3

Please sign in to comment.