Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

feat: .env support

Christian Fei1597065ff9b3
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..5963f5a
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,6 @@
+PORT=3000
+AI_APIKEY=
+AI_MODEL=meta-llama-3.1-8b-instruct
+AI_HOST=http://127.0.0.1:1234
+AI_ENDPOINT=/v1/chat/completions
+AI_TEMPERATURE=0
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 82c0bd5..0d2adc8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,4 +14,4 @@ COPY . .
EXPOSE 3000
-CMD ["node", "index.js"]
+CMD ["npm", "start"]
diff --git a/README.md b/README.md
index 9db34a7..1c58583 100644
--- a/README.md
+++ b/README.md
@@ -59,6 +59,7 @@ cd my-yt
npm i
# install yt-dlp, https://github.com/yt-dlp/yt-dlp
# install ffmpeg, https://ffmpeg.org/
+# optionally, create an .env file (you can copy .env.example as a template)
npm start
```
@@ -106,9 +107,11 @@ Some examples:
```bash
AI_MODEL=gpt-4o-mini AI_HOST=https://api.openai.com AI_APIKEY=sk-proj-123 npm start
-# or with docker in background using OpenAI
+# you can also set them in the `.env` file (you can copy .env.example as a template)
+
+# or with docker in background, using OpenAI
docker run -e AI_MODEL=gpt-4o-mini -e AI_HOST=https://api.openai.com -e AI_APIKEY=sk-proj-123 -d -p 3000:3000 -v $HOME/my-yt-data:/app/data christianfei/my-yt:latest
-# or with docker in background using Anthropic
+# or with docker in background, using Anthropic
docker run -e AI_MODEL=claude-xyz -e AI_HOST=https://api.anthropic.com -e AI_ENDPOINT=/v1/messages -e AI_APIKEY=your-key --rm -it -p 3000:3000 -v $HOME/my-yt-data:/app/data christianfei/my-yt:latest
```
diff --git a/package.json b/package.json
index 61ded84..ad5ea6d 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"version": "1.0.0",
"main": "index.js",
"scripts": {
- "start": "node index.js",
+ "start": "node --env-file-if-exists=.env index.js",
"test": "node --test --test-concurrency 1"
},
"keywords": [],