feat: add PUBLIC_UMAMI_SCRIPT variable and integrate into layout
Some checks failed
Build and Push Docker Image to Gitea / build-and-push (push) Failing after 2m13s
Some checks failed
Build and Push Docker Image to Gitea / build-and-push (push) Failing after 2m13s
This commit is contained in:
@@ -53,6 +53,7 @@ docker run -d \
|
|||||||
-e PUBLIC_API_URL=https://api.pivoine.art \
|
-e PUBLIC_API_URL=https://api.pivoine.art \
|
||||||
-e PUBLIC_URL=https://sexy.pivoine.art \
|
-e PUBLIC_URL=https://sexy.pivoine.art \
|
||||||
-e PUBLIC_UMAMI_ID=your-umami-id \
|
-e PUBLIC_UMAMI_ID=your-umami-id \
|
||||||
|
-e PUBLIC_UMAMI_SCRIPT=https://umami.pivoine.art/script.js \
|
||||||
sexy.pivoine.art:latest
|
sexy.pivoine.art:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -114,6 +115,7 @@ docker-compose -f docker-compose.production.yml up -d --scale frontend=3
|
|||||||
| Variable | Description | Example |
|
| Variable | Description | Example |
|
||||||
|----------|-------------|---------|
|
|----------|-------------|---------|
|
||||||
| `PUBLIC_UMAMI_ID` | Umami analytics tracking ID | `abc123def-456` |
|
| `PUBLIC_UMAMI_ID` | Umami analytics tracking ID | `abc123def-456` |
|
||||||
|
| `PUBLIC_UMAMI_SCRIPT` | Umami script URL | `https://umami.pivoine.art/script.js` |
|
||||||
| `PORT` | Application port (inside container) | `3000` |
|
| `PORT` | Application port (inside container) | `3000` |
|
||||||
| `HOST` | Host binding | `0.0.0.0` |
|
| `HOST` | Host binding | `0.0.0.0` |
|
||||||
| `NODE_ENV` | Node environment | `production` |
|
| `NODE_ENV` | Node environment | `production` |
|
||||||
|
|||||||
@@ -123,7 +123,8 @@ ENV NODE_ENV=production \
|
|||||||
# Runtime environment variables (will be passed at container start)
|
# Runtime environment variables (will be passed at container start)
|
||||||
ENV PUBLIC_API_URL="" \
|
ENV PUBLIC_API_URL="" \
|
||||||
PUBLIC_URL="" \
|
PUBLIC_URL="" \
|
||||||
PUBLIC_UMAMI_ID=""
|
PUBLIC_UMAMI_ID="" \
|
||||||
|
PUBLIC_UMAMI_SCRIPT=""
|
||||||
|
|
||||||
# Expose application port
|
# Expose application port
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ cat > .env.production << EOF
|
|||||||
PUBLIC_API_URL=https://api.your-domain.com
|
PUBLIC_API_URL=https://api.your-domain.com
|
||||||
PUBLIC_URL=https://your-domain.com
|
PUBLIC_URL=https://your-domain.com
|
||||||
PUBLIC_UMAMI_ID=
|
PUBLIC_UMAMI_ID=
|
||||||
|
PUBLIC_UMAMI_SCRIPT=
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -129,6 +130,7 @@ docker pull ghcr.io/valknarxxx/sexy:latest
|
|||||||
| Variable | Description | Example |
|
| Variable | Description | Example |
|
||||||
|----------|-------------|---------|
|
|----------|-------------|---------|
|
||||||
| `PUBLIC_UMAMI_ID` | Analytics tracking ID | `abc-123-def` |
|
| `PUBLIC_UMAMI_ID` | Analytics tracking ID | `abc-123-def` |
|
||||||
|
| `PUBLIC_UMAMI_SCRIPT` | Umami script URL | `https://umami.example.com/script.js` |
|
||||||
|
|
||||||
## Common Commands
|
## Common Commands
|
||||||
|
|
||||||
|
|||||||
@@ -211,7 +211,8 @@ pnpm --filter @sexy.pivoine.art/frontend start
|
|||||||
|
|
||||||
### 💜 Optional (The Extras)
|
### 💜 Optional (The Extras)
|
||||||
|
|
||||||
- `PUBLIC_UMAMI_ID` — Analytics tracking
|
- `PUBLIC_UMAMI_ID` — Analytics tracking ID
|
||||||
|
- `PUBLIC_UMAMI_SCRIPT` — Umami script URL
|
||||||
|
|
||||||
See [.env.production.example](.env.production.example) for the full configuration.
|
See [.env.production.example](.env.production.example) for the full configuration.
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ SvelteKit's `PUBLIC_*` environment variables are **baked into the JavaScript** a
|
|||||||
1. ✅ Changing `PUBLIC_API_URL`
|
1. ✅ Changing `PUBLIC_API_URL`
|
||||||
2. ✅ Changing `PUBLIC_URL`
|
2. ✅ Changing `PUBLIC_URL`
|
||||||
3. ✅ Changing `PUBLIC_UMAMI_ID`
|
3. ✅ Changing `PUBLIC_UMAMI_ID`
|
||||||
4. ❌ NOT needed for Directus env vars (those are runtime)
|
4. ✅ Changing `PUBLIC_UMAMI_SCRIPT`
|
||||||
|
5. ❌ NOT needed for Directus env vars (those are runtime)
|
||||||
|
|
||||||
## Quick Rebuild Process
|
## Quick Rebuild Process
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ Set your production values:
|
|||||||
PUBLIC_API_URL=https://sexy.pivoine.art/api
|
PUBLIC_API_URL=https://sexy.pivoine.art/api
|
||||||
PUBLIC_URL=https://sexy.pivoine.art
|
PUBLIC_URL=https://sexy.pivoine.art
|
||||||
PUBLIC_UMAMI_ID=your-umami-id
|
PUBLIC_UMAMI_ID=your-umami-id
|
||||||
|
PUBLIC_UMAMI_SCRIPT=https://umami.pivoine.art/script.js
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Rebuild the Image
|
### 2. Rebuild the Image
|
||||||
@@ -250,6 +252,7 @@ These are runtime environment variables and can be changed in docker-compose.
|
|||||||
| `PUBLIC_API_URL` | ✅ Yes | Rebuild image |
|
| `PUBLIC_API_URL` | ✅ Yes | Rebuild image |
|
||||||
| `PUBLIC_URL` | ✅ Yes | Rebuild image |
|
| `PUBLIC_URL` | ✅ Yes | Rebuild image |
|
||||||
| `PUBLIC_UMAMI_ID` | ✅ Yes | Rebuild image |
|
| `PUBLIC_UMAMI_ID` | ✅ Yes | Rebuild image |
|
||||||
|
| `PUBLIC_UMAMI_SCRIPT` | ✅ Yes | Rebuild image |
|
||||||
| `SEXY_DIRECTUS_*` | ❌ No | Restart container |
|
| `SEXY_DIRECTUS_*` | ❌ No | Restart container |
|
||||||
| `DB_*` | ❌ No | Restart container |
|
| `DB_*` | ❌ No | Restart container |
|
||||||
| `EMAIL_*` | ❌ No | Restart container |
|
| `EMAIL_*` | ❌ No | Restart container |
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ services:
|
|||||||
PUBLIC_API_URL: ${SEXY_FRONTEND_PUBLIC_API_URL}
|
PUBLIC_API_URL: ${SEXY_FRONTEND_PUBLIC_API_URL}
|
||||||
PUBLIC_URL: ${SEXY_FRONTEND_PUBLIC_URL}
|
PUBLIC_URL: ${SEXY_FRONTEND_PUBLIC_URL}
|
||||||
PUBLIC_UMAMI_ID: ${SEXY_FRONTEND_PUBLIC_UMAMI_ID:-}
|
PUBLIC_UMAMI_ID: ${SEXY_FRONTEND_PUBLIC_UMAMI_ID:-}
|
||||||
|
PUBLIC_UMAMI_SCRIPT: ${SEXY_FRONTEND_PUBLIC_UMAMI_SCRIPT:-}
|
||||||
|
|
||||||
# Override volume for production path
|
# Override volume for production path
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ services:
|
|||||||
PUBLIC_API_URL: ${SEXY_FRONTEND_PUBLIC_API_URL:-http://localhost:8055}
|
PUBLIC_API_URL: ${SEXY_FRONTEND_PUBLIC_API_URL:-http://localhost:8055}
|
||||||
PUBLIC_URL: ${SEXY_FRONTEND_PUBLIC_URL:-http://localhost:3000}
|
PUBLIC_URL: ${SEXY_FRONTEND_PUBLIC_URL:-http://localhost:3000}
|
||||||
PUBLIC_UMAMI_ID: ${SEXY_FRONTEND_PUBLIC_UMAMI_ID:-}
|
PUBLIC_UMAMI_ID: ${SEXY_FRONTEND_PUBLIC_UMAMI_ID:-}
|
||||||
|
PUBLIC_UMAMI_SCRIPT: ${SEXY_FRONTEND_PUBLIC_UMAMI_SCRIPT:-}
|
||||||
|
|
||||||
# Timezone
|
# Timezone
|
||||||
TZ: ${TIMEZONE:-Europe/Amsterdam}
|
TZ: ${TIMEZONE:-Europe/Amsterdam}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
PUBLIC_API_URL=https://sexy.pivoine.art/api
|
PUBLIC_API_URL=https://sexy.pivoine.art/api
|
||||||
PUBLIC_URL=https://sexy.pivoine.art
|
PUBLIC_URL=https://sexy.pivoine.art
|
||||||
PUBLIC_UMAMI_ID=
|
PUBLIC_UMAMI_ID=
|
||||||
|
PUBLIC_UMAMI_SCRIPT=
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ class Logger {
|
|||||||
PUBLIC_API_URL: process.env.PUBLIC_API_URL,
|
PUBLIC_API_URL: process.env.PUBLIC_API_URL,
|
||||||
PUBLIC_URL: process.env.PUBLIC_URL,
|
PUBLIC_URL: process.env.PUBLIC_URL,
|
||||||
PUBLIC_UMAMI_ID: process.env.PUBLIC_UMAMI_ID ? '***set***' : 'not set',
|
PUBLIC_UMAMI_ID: process.env.PUBLIC_UMAMI_ID ? '***set***' : 'not set',
|
||||||
|
PUBLIC_UMAMI_SCRIPT: process.env.PUBLIC_UMAMI_SCRIPT || 'not set',
|
||||||
PORT: process.env.PORT || '3000',
|
PORT: process.env.PORT || '3000',
|
||||||
HOST: process.env.HOST || '0.0.0.0',
|
HOST: process.env.HOST || '0.0.0.0',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Footer from "$lib/components/footer/footer.svelte";
|
|||||||
import { Toaster } from "$lib/components/ui/sonner";
|
import { Toaster } from "$lib/components/ui/sonner";
|
||||||
import Header from "$lib/components/header/header.svelte";
|
import Header from "$lib/components/header/header.svelte";
|
||||||
import AgeVerificationDialog from "$lib/components/age-verification-dialog/age-verification-dialog.svelte";
|
import AgeVerificationDialog from "$lib/components/age-verification-dialog/age-verification-dialog.svelte";
|
||||||
import { PUBLIC_UMAMI_ID } from "$env/static/public";
|
import { PUBLIC_UMAMI_ID, PUBLIC_UMAMI_SCRIPT } from "$env/static/public";
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await waitLocale();
|
await waitLocale();
|
||||||
@@ -17,10 +17,10 @@ let { children, data } = $props();
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
{#if import.meta.env.PROD && PUBLIC_UMAMI_ID}
|
{#if import.meta.env.PROD && PUBLIC_UMAMI_ID && PUBLIC_UMAMI_SCRIPT}
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
src="https://umami.pivoine.art/script.js"
|
src={PUBLIC_UMAMI_SCRIPT}
|
||||||
data-website-id={PUBLIC_UMAMI_ID}
|
data-website-id={PUBLIC_UMAMI_ID}
|
||||||
></script>
|
></script>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user