Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Added NB_QUERY_PATH env var to configure path variable #227

Merged
merged 4 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ but before proceeding with either you need to set the environment variables.

### Mandatory configuration

| Environment variable | Type | Required | Default value if not set | Example |
| -------------------- | ------- | -------------------------------------- | ------------------------ | ------------------------------------------------------- |
| NB_API_QUERY_URL | string | Yes | - | https://federate.neurobagel.org/ |
| NB_IS_FEDERATION_API | boolean | No | true | true |
| NB_ENABLE_AUTH | boolean | no | false | false |
| NB_QUERY_CLIENT_ID | string | Yes (if NB_ENABLE_AUTH is set to true) | - | 46923719231972-dhsahgasl3123.apps.googleusercontent.com |
| Environment variable | Type | Required | Default value if not set | Example |
| ---------------------- | ------- | ---------------------------------------- | ------------------------ | --------------------------------------------------------- |
| `NB_API_QUERY_URL` | string | Yes | - | `https://federate.neurobagel.org/` |
| `NB_IS_FEDERATION_API` | boolean | No | `true` | `true` |
| `NB_QUERY_URL_PATH` | string | No | `/` | `/query/` |
| `NB_ENABLE_AUTH` | boolean | No | `false` | `false` |
| `NB_QUERY_CLIENT_ID` | string | Yes (if `NB_ENABLE_AUTH` is set to true) | - | `46923719231972-dhsahgasl3123.apps.googleusercontent.com` |

#### `NB_API_QUERY_URL`

Expand All @@ -62,6 +63,10 @@ You'll need to set the `NB_API_QUERY_URL` environment variable required to run t

If the API you'd like to send queries to is not a [federation api](https://neurobagel.org/federate/), you need to set the `NB_IS_FEDERATION_API` to `false` as it is `true` by default.

#### `NB_QUERY_URL_PATH`

If you are using a custom configuration where the query tool is accessible via a path other than the root (`/`), you need to set the `NB_QUERY_URL_PATH` to your custom path. This ensures that the query tool is correctly rendered and accessible at the specified URL

#### `NB_ENABLE_AUTH`

If the API you'd like to send queries to requires authentication, you need to set `NB_ENABLE_AUTH` to `true` as it is `false` by default. This will enable authentication flow of the app.
Expand Down
4 changes: 2 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import { StyledEngineProvider } from '@mui/material/styles';
import { GoogleOAuthProvider } from '@react-oauth/google';
import App from './App';
import { enableAuth, clientID } from './utils/constants';
import { queryURLPath, enableAuth, clientID } from './utils/constants';
import './index.css';

const router = createBrowserRouter([
{
path: '/',
path: queryURLPath,
element: <App />,
},
]);
Expand Down
2 changes: 2 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export const isFederationAPI: boolean =
? true
: import.meta.env.NB_IS_FEDERATION_API.toLowerCase() === 'true';

export const queryURLPath: string = import.meta.env.NB_QUERY_URL_PATH ?? '/';

export const enableAuth: boolean =
import.meta.env.NB_ENABLE_AUTH === undefined
? false
Expand Down