umami icon indicating copy to clipboard operation
umami copied to clipboard

COLLECT_API_ENDPOINT does not work

Open Aermisty opened this issue 4 years ago • 7 comments

I just upgraded umami to v1.34.0 and set the environment variable COLLECT_API_ENDPOINT: '/api/x' in docker-compose settings.

services:
  umami:
    image: ghcr.io/umami-software/umami:postgresql-latest
    environment:
      TRACKER_SCRIPT_NAME: 'script'
      COLLECT_API_ENDPOINT: '/api/x'

But this environment variable seems does not work. In my tracker script, the endpoint is still /api/collect. I tried to clear cookies and restarted the docker container, but nothing changed.

Aermisty avatar Jul 21 '22 12:07 Aermisty

I have the same problem

AntoninHuaut avatar Jul 21 '22 14:07 AntoninHuaut

Just updated the documentation to make this more clear, but COLLECT_API_ENDPOINT is a build time variable. So you will need to rebuild the application for it to take effect. See https://umami.is/docs/environment-variables

mikecao avatar Jul 21 '22 15:07 mikecao

Should be fixed in v1.35.0.

mikecao avatar Jul 22 '22 04:07 mikecao

Just updated the documentation to make this more clear, but COLLECT_API_ENDPOINT is a build time variable. So you will need to rebuild the application for it to take effect. See https://umami.is/docs/environment-variables

@mikecao For the runtime variables such as TRACKER_SCRIPT_NAME, I can set it in a docker-compose file.

But how about a build time variable in v1.35.0? Does it mean that I need to build a custom Docker image first?

Aermisty avatar Jul 22 '22 08:07 Aermisty

https://docker-docs.netlify.app/compose/compose-file/#args

mikecao avatar Jul 22 '22 19:07 mikecao

Hey @leirock, how have you solved this? I've tried creating my own Dockerfile like this (./umami/Dockerfile):

ARG COLLECT_API_ENDPOINT
FROM ghcr.io/mikecao/umami:postgresql-latest

And I pass the build argument like this in my docker-compose.yml:

  umami:
    build:
      context: ./umami
      args:
        COLLECT_API_ENDPOINT: "/api/abc"

I feel like I'm missing something obvious 😅

ioiste avatar Aug 02 '22 19:08 ioiste

@ioiste Sorry, I'm just using the official docker image, so I haven't tried the variable COLLECT_API_ENDPOINT.

Aermisty avatar Aug 03 '22 20:08 Aermisty