added environment for vue, split dockerfiles, add rust dependencies.

This commit is contained in:
2024-03-28 14:52:06 +01:00
parent a2e2ff141e
commit c1615a1bcb
12 changed files with 352 additions and 13 deletions
+2
View File
@@ -0,0 +1,2 @@
VITE_API_BASE_URL=http://localhost:8001
+2
View File
@@ -0,0 +1,2 @@
VITE_API_BASE_URL=http://rust-app:8001
+22
View File
@@ -0,0 +1,22 @@
FROM node:lts-alpine
# install simple http server for serving static content
RUN npm install -g http-server
# make the 'app' folder the current working directory
WORKDIR /app
# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./
# install project dependencies
RUN npm install
# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .
# build app for production with minification
RUN npm run build
EXPOSE 8080
CMD [ "http-server", "dist" ]
+13
View File
@@ -18,6 +18,7 @@
"@rushstack/eslint-patch": "^1.3.2",
"@vitejs/plugin-vue": "^4.3.1",
"@vue/eslint-config-prettier": "^8.0.0",
"dotenv": "^16.4.5",
"eslint": "^8.46.0",
"eslint-plugin-vue": "^9.16.1",
"prettier": "^3.0.0",
@@ -1025,6 +1026,18 @@
"node": ">=6.0.0"
}
},
"node_modules/dotenv": {
"version": "16.4.5",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
"integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
"dev": true,
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/esbuild": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz",
+1
View File
@@ -20,6 +20,7 @@
"@rushstack/eslint-patch": "^1.3.2",
"@vitejs/plugin-vue": "^4.3.1",
"@vue/eslint-config-prettier": "^8.0.0",
"dotenv": "^16.4.5",
"eslint": "^8.46.0",
"eslint-plugin-vue": "^9.16.1",
"prettier": "^3.0.0",
+1 -1
View File
@@ -38,7 +38,7 @@ async function login() {
localStorage.setItem("user-id", user_id)
sessionStorage.setItem("user-id", user_id)
sessionStorage.setItem("user-token", token)
router.push({ name: 'about' })
router.push({ name: 'feeds' })
}
// Handle success
} catch (error) {
+13 -5
View File
@@ -2,6 +2,14 @@ import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import dotenv from 'dotenv';
console.log('process.env:', process.env);
console.log('TEst:', process.env.VITE_API_BASE_URL);
// Load environment variables based on the environment mode
dotenv.config({
path: `.env.${process.env.NODE_ENV || 'development'}`
});
// https://vitejs.dev/config/
export default defineConfig({
@@ -17,31 +25,31 @@ export default defineConfig({
server: {
proxy: {
'/login/rss': {
target: 'http://localhost:8001/api/v1/auth/login',
target: `${process.env.VITE_API_BASE_URL}/api/v1/auth/login`,
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/login\/rss/, ''),
},
'/feeds/get': {
target: 'http://localhost:8001/api/v1/article/get',
target: `${process.env.VITE_API_BASE_URL}/api/v1/article/get`,
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/feeds\/get/, ''),
},
'/feeds/sync': {
target: 'http://localhost:8001/api/v1/article/sync',
target: `${process.env.VITE_API_BASE_URL}/api/v1/article/sync`,
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/feeds\/sync/, ''),
},
'/feeds/read': {
target: 'http://localhost:8001/api/v1/article/read',
target: `${process.env.VITE_API_BASE_URL}/api/v1/article/read`,
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/feeds\/read/, ''),
},
'/feeds/add': {
target: 'http://localhost:8001/api/v1/article/add',
target: `${process.env.VITE_API_BASE_URL}/api/v1/article/add`,
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/feeds\/add/, ''),