From f051721df3c6bc6d855ba5d8865512a7ddafd6f1 Mon Sep 17 00:00:00 2001 From: jinhojang6 Date: Wed, 13 Mar 2024 01:19:35 +0900 Subject: [PATCH] docs: add .env instruction --- README.md | 12 ++++++++-- fetch-content.js | 25 ++++++++++++++++++-- vac/1/images/lifecycle.png | Bin 78136 -> 78136 bytes waku/standards/core/17/images/rln-relay.png | Bin 170277 -> 170288 bytes 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dc1bfae6e..16603bfd5 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,20 @@ $ git clone https://github.com/acid-info/logos-docs-template.git $ yarn install ``` -3. Start the website: +3. Create .env and run fetch-content.js +```bash +GITHUB_TOKEN= +``` + +and `node fetch-content.js` + +4. Start the website: + ```bash $ yarn start ``` -4. Visit `http://localhost:3000` in your browser +5. Visit `http://localhost:3000` in your browser ## Configuration diff --git a/fetch-content.js b/fetch-content.js index c0f19f34f..bca226dbf 100644 --- a/fetch-content.js +++ b/fetch-content.js @@ -2,7 +2,27 @@ const https = require('https') const fs = require('fs') const path = require('path') -// NOTE: Replace YOUR_GITHUB_TOKEN with your GitHub token +function loadEnv() { + const envPath = path.resolve(process.cwd(), '.env') + + try { + const data = fs.readFileSync(envPath, 'utf8') + + data.split('\n').forEach(line => { + line = line.trim() + + if (line && !line.startsWith('#')) { + const [key, value] = line.split('=') + process.env[key.trim()] = value.trim() + } + }) + } catch (err) { + console.error('Error loading .env file', err) + } +} + +loadEnv() + async function fetchFromGitHub(url, callback) { https .get( @@ -10,7 +30,8 @@ async function fetchFromGitHub(url, callback) { { headers: { 'User-Agent': 'Node.js', - Authorization: `token {YOUR_GITHUB_TOKEN}`, + // NOTE: Create .env file and add GITHUB_TOKEN=your_token + Authorization: `token ${process.env.GITHUB_TOKEN}`, }, }, res => { diff --git a/vac/1/images/lifecycle.png b/vac/1/images/lifecycle.png index c96f54df7a80de08e6db5731030809228356b22b..415784b54c52e1798545ed2b9e5564954961c88c 100644 GIT binary patch delta 24 gcmdn-h-JqkmJQ1$OnxwzW%Ke0k>%T&IT%ef0ix9l5&!@I delta 19 bcmdn-h-JqkmJQ1$Y+gAbs(c#