Skip to content

Commit

Permalink
Merge pull request #80 from Scaffold-Stark/feat/optional-algolia
Browse files Browse the repository at this point in the history
feat: optional algolia
  • Loading branch information
0xquantum3labs authored Jan 11, 2025
2 parents c708bab + a2a7560 commit d4fea54
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 21 deletions.
9 changes: 6 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
APP_ID=
API_KEY=
INDEX_NAME=
ALGOLIA_SEARCH_ENABLED=false

# if ALGOLIA_SEARCH_ENABLED is true, you need to fill in these environment variables
ALGOLIA_APP_ID=
ALGOLIA_API_KEY=
ALGOLIA_INDEX_NAME=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
.docusaurus
build
.idea
.env
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ npm install
npm run start
```

### Using the Algolia Search

The repository will disable Algolia search by default. you can enable Algolia search by setting `ALGOLIA_SEARCH_ENABLED` environment variable to `true`, provided you have the other required environment variables.

Note that you might need to restart the app after you update the environment variables.

## Contribution Guidelines

Thank you for your interest in contributing to improve the documentation!
Expand Down
6 changes: 3 additions & 3 deletions docs/deploying/deploy-smart-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ By default `yarn deploy` will deploy contract to the local network. You can chan
Run the command below to deploy the smart contract to the target network. Make sure to have some funds in your deployer account to pay for the transaction.

```
yarn deploy --network network_name
yarn deploy --network <NETWORK_NAME>
```

eg: `yarn deploy --network sepolia`
e.g. `yarn deploy --network sepolia`

## Configuration of Third-Party Services for Production-Grade Apps.

Expand All @@ -41,5 +41,5 @@ For production-grade applications, it's recommended to obtain your own API keys
- `RPC_URL_SEPOLIA` variable in `packages/snfoundry/.env` and `packages/nextjs/.env.local`. You can create API keys from the [Alchemy dashboard](https://dashboard.alchemy.com/).

:::tip Hint
It's recommended to store envs for nextjs in Vercel/system env config for live apps and use .env.local for local testing.
It's recommended to store environment variables for nextjs in vercel/system env config for live apps and use `.env.local` for local testing.
:::tip Hint
32 changes: 18 additions & 14 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,24 @@ const config = {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
algolia: {
appId: process.env.APP_ID,
apiKey: process.env.API_KEY,
indexName: process.env.INDEX_NAME,
contextualSearch: true,
externalUrlRegex: "external\\.com|domain\\.com",
replaceSearchResultPathname: {
from: "/docs/",
to: "/",
},
searchParameters: {},
searchPagePath: "search",
insights: false,
},
...((process.env.ALGOLIA_SEARCH_ENABLED || "false") === "true"
? {
algolia: {
appId: process.env.ALGOLIA_APP_ID,
apiKey: process.env.ALGOLIA_API_KEY,
indexName: process.env.ALGOLIA_INDEX_NAME,
contextualSearch: true,
externalUrlRegex: "external\\.com|domain\\.com",
replaceSearchResultPathname: {
from: "/docs/",
to: "/",
},
searchParameters: {},
searchPagePath: "search",
insights: false,
},
}
: {}),
}),
};

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"format": "npx prettier --write '**/*.{js,jsx,md,mdx,json,css}'",
"format-check": "npx prettier --check '**/*.{js,jsx,md,mdx,json,css}'"
"format-check": "npx prettier --check '**/*.{js,jsx,md,mdx,json,css}'",
"postinstall": "cp -n .env.example .env"
},
"dependencies": {
"@docusaurus/core": "2.4.0",
Expand Down

0 comments on commit d4fea54

Please sign in to comment.