only init faro when env is production
This commit is contained in:
@@ -27,9 +27,14 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get version from package.json
|
||||||
|
VERSION=$(node -p "require('./package.json').version")
|
||||||
|
|
||||||
cat > .env.production <<EOF
|
cat > .env.production <<EOF
|
||||||
VITE_FLATTASTIC_API_KEY=${VITE_FLATTASTIC_API_KEY}
|
VITE_FLATTASTIC_API_KEY=${VITE_FLATTASTIC_API_KEY}
|
||||||
VITE_HA_TOKEN=${VITE_HA_TOKEN}
|
VITE_HA_TOKEN=${VITE_HA_TOKEN}
|
||||||
|
VITE_APP_VERSION=${VERSION}
|
||||||
|
VITE_APP_ENV=production
|
||||||
EOF
|
EOF
|
||||||
env:
|
env:
|
||||||
VITE_FLATTASTIC_API_KEY: ${{ secrets.VITE_FLATTASTIC_API_KEY }}
|
VITE_FLATTASTIC_API_KEY: ${{ secrets.VITE_FLATTASTIC_API_KEY }}
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
# Set production environment
|
||||||
|
ENV VITE_APP_ENV=production
|
||||||
|
|
||||||
COPY ./dist /usr/share/nginx/html
|
COPY ./dist /usr/share/nginx/html
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
+7
-3
@@ -8,13 +8,17 @@ import {
|
|||||||
import Dashboard from "@/components/Dashboard/Dashboard";
|
import Dashboard from "@/components/Dashboard/Dashboard";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
if (window.location.hostname === "localhost") {
|
const isProduction = import.meta.env.PROD;
|
||||||
|
|
||||||
|
if (isProduction) {
|
||||||
|
console.debug("Initializing Faro environment...");
|
||||||
|
|
||||||
initializeFaro({
|
initializeFaro({
|
||||||
url: "http://localhost:12347/collect",
|
url: "http://localhost:12347/collect",
|
||||||
app: {
|
app: {
|
||||||
name: "monitor-im-flur",
|
name: "monitor-im-flur",
|
||||||
version: "0.0.1",
|
version: import.meta.env.VITE_APP_VERSION || "0.0.1",
|
||||||
environment: "development",
|
environment: "production",
|
||||||
},
|
},
|
||||||
instrumentations: [
|
instrumentations: [
|
||||||
...getWebInstrumentations(),
|
...getWebInstrumentations(),
|
||||||
|
|||||||
Reference in New Issue
Block a user