mirror of
https://github.com/vacp2p/rfc.vac.dev.git
synced 2026-01-07 21:33:54 -05:00
docs: add .env instruction
This commit is contained in:
12
README.md
12
README.md
@@ -19,12 +19,20 @@ $ git clone https://github.com/acid-info/logos-docs-template.git
|
|||||||
$ yarn install
|
$ 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
|
```bash
|
||||||
$ yarn start
|
$ yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Visit `http://localhost:3000` in your browser
|
5. Visit `http://localhost:3000` in your browser
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|||||||
@@ -2,7 +2,27 @@ const https = require('https')
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
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) {
|
async function fetchFromGitHub(url, callback) {
|
||||||
https
|
https
|
||||||
.get(
|
.get(
|
||||||
@@ -10,7 +30,8 @@ async function fetchFromGitHub(url, callback) {
|
|||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': 'Node.js',
|
'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 => {
|
res => {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user