Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: connect to backend through relative paths #170

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .env

This file was deleted.

17 changes: 11 additions & 6 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ jobs:
if: github.ref_type == 'branch'
run: |
cat << EOF > .env
VITE_BACKEND_URL="https://testleaphyeasybloqs.com"
VITE_MATOMO_URL="https://leaphyeasybloqs.com/matomo/"
VITE_MATOMO_SITE_ID="2"
VITE_BACKEND_URL=""
VITE_SENTRY_DSN="${{ secrets.VITE_SENTRY_DSN }}"
VITE_SENTRY_SAMPLE_RATE="1.0"
VITE_SENTRY_SAMPLE_RATE="0.0"
VITE_RECORDINGS_API="https://recordings.leaphyeasybloqs.com"
VITE_RECORDINGS_ADDRESS=".testleaphyeasybloqs.com"
EOF
Expand All @@ -46,8 +44,8 @@ jobs:
if: github.ref_type == 'tag'
run: |
cat << EOF > .env
VITE_BACKEND_URL="https://leaphyeasybloqs.com"
VITE_MATOMO_URL="https://leaphyeasybloqs.com/matomo/"
VITE_BACKEND_URL=""
VITE_MATOMO_URL="/matomo/"
VITE_MATOMO_SITE_ID="1"
VITE_SENTRY_DSN="${{ secrets.VITE_SENTRY_DSN }}"
VITE_SENTRY_SAMPLE_RATE="0.0"
Expand All @@ -66,6 +64,13 @@ jobs:
yarn --frozen-lockfile --prefer-offline
yarn build

- name: Upload build files
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: leaphyeasybloqs-${{ github.ref_name }}
path: ./dist

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ node_modules
dist
dist-ssr
*.local
.env

# Editor directories and files
.vscode/*
Expand All @@ -26,4 +27,4 @@ dist-ssr
/blob-report/
/playwright/.cache/

vite.config.ts.timestamp*.mjs
vite.config.ts.timestamp*.mjs
9 changes: 4 additions & 5 deletions src/lib/matomo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@ declare global {
function initMatomo() {
// Always create the _paq array so dev code works
const _paq = (window._paq = window._paq || []);
// Only track prod builds
if (!import.meta.env.PROD) return;
const url = import.meta.env.VITE_MATOMO_URL;
if (!url) return;

const u = import.meta.env.VITE_MATOMO_URL;
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
_paq.push(["setTrackerUrl", `${u}matomo.php`]);
_paq.push(["setTrackerUrl", `${url}matomo.php`]);
_paq.push(["setSiteId", import.meta.env.VITE_MATOMO_SITE_ID]);

const d = document;
const g = d.createElement("script");
const s = d.getElementsByTagName("script")[0];
g.type = "text/javascript";
g.async = true;
g.src = `${u}matomo.js`;
g.src = `${url}matomo.js`;
s.parentNode.insertBefore(g, s);
}

Expand Down