Skip to content

Commit

Permalink
Update redirector env vars to VITE syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandenburgh committed Nov 30, 2023
1 parent 4502e00 commit 81d521b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/design/apex-domain-netlify.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Currently, the GUI is served at gui.dandiarchive.org, while the apex domain dand
We've decided that our UI is stable enough to warrant serving it directly at dandiarchive.org, leaving just the task of serving a JSON file containing deployment information. Netlify seems capable of performing this task, and this document outlines the proposal to do so.

## Serving the Deployment JSON file
Netlify cannot specify a different set of redirects for a different build context, so a custom plugin is required. Netlify does support custom JS plugins that hook into the build process and modify the Netlify configuration, so we can use that to specify a different redirect based on the `VUE_APP_DANDI_API_ROOT` environment variable. This redirect will proxy `dandiarchive.org/server-info` to `api.dandiarchive/api/server-info`, or the appropriate domains for staging.
Netlify cannot specify a different set of redirects for a different build context, so a custom plugin is required. Netlify does support custom JS plugins that hook into the build process and modify the Netlify configuration, so we can use that to specify a different redirect based on the `VITE_APP_DANDI_API_ROOT` environment variable. This redirect will proxy `dandiarchive.org/server-info` to `api.dandiarchive/api/server-info`, or the appropriate domains for staging.

## Backwards Compatibility

Expand Down
4 changes: 2 additions & 2 deletions web/netlify/plugins/server-info-build/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
// Use onPostBuild hook so that the dist/ folder exists
onPostBuild: ({ netlifyConfig }) => {
let apiUrl = process.env.VUE_APP_DANDI_API_ROOT;
let apiUrl = process.env.VITE_APP_DANDI_API_ROOT;
if (apiUrl === undefined) {
throw new Error('API URL not defined. Please define it with the VUE_APP_DANDI_API_ROOT environment variable.');
throw new Error('API URL not defined. Please define it with the VITE_APP_DANDI_API_ROOT environment variable.');
}

// Add redirect to server info
Expand Down

0 comments on commit 81d521b

Please sign in to comment.