From 2a03461a214773f582b482ec41ae9b8f3049a5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Thu, 23 Nov 2023 11:31:04 +0100 Subject: [PATCH] Improve readme --- .env.example | 6 +++--- README.md | 34 ++++++++++++++-------------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/.env.example b/.env.example index 18923a3b2..1e7f58a10 100644 --- a/.env.example +++ b/.env.example @@ -1,12 +1,12 @@ # Mode to serve only a single space # Ex: http://localhost:4000 # GITBOOK_MODE=single -GITBOOK_SPACE_ID=your_space_id -GITBOOK_TOKEN=your_token_here +# GITBOOK_SPACE_ID=your_space_id +# GITBOOK_TOKEN=your_token_here # Mode to serve multiple spaces using the entire url # Ex: http://docs.mycompany.com/page1 -GITBOOK_MODE=multi +# GITBOOK_MODE=multi # Mode to serve multiple spaces with the space url passed as a path # Ex: http://localhost:4000/docs.mycompany.com/page1 diff --git a/README.md b/README.md index 7f8377411..7cfeeaa55 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,9 @@ Next.js application to render GitBook published content. -## Self-hosting - -This repository is designed to allow self-hosting the rendering of your GitBook published content. Self-hosting has pros and cons, on the pro side you can customize the look and feel and better embed your documentation in your application; on the cons side you become responsible for the reliability and keeping the renderer up-to-date with the changes on the GitBook platform. - -This application can easily be configured and deployed on Vercel or Cloudflare to serve a specific space content (**self-hosting**). It requires a minimum amount of configuration: - -- `GITBOOK_MODE=single` -- `GITBOOK_SPACE_ID`: ID of the GitBook.com space to render -- `GITBOOK_TOKEN`: a GitBook.com API token that has access to the space defined in `GITBOOK_SPACE_ID` - ## Development -#### Installation +#### Start the local server Clone the repository and use [Bun](https://bun.sh/) to install dependencies and run the local development server. @@ -22,19 +12,13 @@ Clone the repository and use [Bun](https://bun.sh/) to install dependencies and bun install ``` -#### Local Configuration - -To develop and test a GitBook space locally (`http://localhost:3000//**`), first create a [GitBook API token](https://app.gitbook.com/account/developer) and put it in a `.env.local` file: +To test multiple GitBook content locally, create a `.env.local` file, with the following content: ``` -GITBOOK_TOKEN=gb_api_abc +GITBOOK_MODE=multi-path ``` -This step is not required when developing using URL lookup (`http://.localhost:3000/`). - -#### Start the local server - -Run the Next.js development server. +Run the Next.js development server: ``` bun dev @@ -46,3 +30,13 @@ Then open the space in your web browser, using `http://localhost:3000/` (ex - `bun format`: format the code - `bun lint`: lint the code + +## Self-hosting + +This repository is designed to allow self-hosting the rendering of your GitBook published content. Self-hosting has pros and cons, on the pro side you can customize the look and feel and better embed your documentation in your application; on the cons side you become responsible for the reliability and keeping the renderer up-to-date with the changes on the GitBook platform. + +This application can easily be configured and deployed on Vercel or Cloudflare to serve a specific space content (**self-hosting**). It requires a minimum amount of configuration: + +- `GITBOOK_MODE=single` +- `GITBOOK_SPACE_ID`: ID of the GitBook.com space to render +- `GITBOOK_TOKEN`: a GitBook.com API token that has access to the space defined in `GITBOOK_SPACE_ID`