mirror of
https://github.com/vacp2p/rfc.vac.dev.git
synced 2025-02-22 04:18:27 +00:00
docs: add .env instruction
This commit is contained in:
parent
6955a5443e
commit
f051721df3
12
README.md
12
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
|
||||
|
@ -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 => {
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user