[GH-ISSUE #81] [BUG] VIKUNJA_SERVICE_ENABLEREGISTRATION environment variable not being set #5945

Closed
opened 2026-04-20 16:24:13 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @soderluk on GitHub (Aug 23, 2023).
Original GitHub issue: https://github.com/go-vikunja/vikunja/issues/81

Description

I'm using docker-compose to run vikunja, and everything works nicely, except that when I set the VIKUNJA_SERVICE_ENABLEREGISTRATION=false or VIKUNJA_SERVICE_ENABLEREGISTRATION=0 it's still VIKUNJA_SERVICE_ENABLEREGISTRATION='true' in the container.

My docker-compose.yml file:

version: '3'

services:
  database:
    image: postgres:14-alpine@sha256:28407a9961e76f2d285dc6991e8e48893503cc3836a4755bbc2d40bcc272a441
    container_name: vikunja_postgres
    env_file:
      - .env
    volumes:
      - vikunja_postgres:/var/lib/postgresql/data
    restart: always

  api:
    image: vikunja/api
    container_name: vikunja_api
    env_file:
      - .env
    volumes:
      - vikunja_api:/app/vikunja/files
    ports:
      - 3456:3456
    depends_on:
      - database
    restart: always

  frontend:
    image: vikunja/frontend
    container_name: vikunja_frontend
    ports:
      - 8081:80
    restart: always

volumes:
  vikunja_postgres:
  vikunja_api:

Here's the .env file:

POSTGRES_PASSWORD="secret"
POSTGRES_USER="vikunja"
POSTGRES_DB="vikunja"

VIKUNJA_DATABASE_HOST="vikunja_postgres"
VIKUNJA_DATABASE_TYPE="postgres"
VIKUNJA_DATABASE_PASSWORD="${POSTGRES_PASSWORD}"
VIKUNJA_DATABASE_USER="${POSTGRES_USER}"
VIKUNJA_DATABASE_DATABASE="${POSTGRES_DB}"
VIKUNJA_SERVICE_JWTSECRET="super secret"
VIKUNJA_SERVICE_FRONTENDURL="https://vikunja.domain.com/"
VIKUNJA_SERVICE_ENABLEREGISTRATION=false

Everything else is set correctly, but the VIKUNJA_SERVICE_ENABLEREGISTRATION.
Verified by docker exec -it vikunja_api sh and running /app/vikunja # export:

export HOME='/root'
export HOSTNAME='26d323421cb1'
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
export PGID='1000'
export POSTGRES_DB='vikunja'
export POSTGRES_PASSWORD='secret'
export POSTGRES_USER='vikunja'
export PUID='1000'
export PWD='/app/vikunja'
export SHLVL='1'
export TERM='xterm'
export VIKUNJA_DATABASE_DATABASE='vikunja'
export VIKUNJA_DATABASE_HOST='vikunja_postgres'
export VIKUNJA_DATABASE_PASSWORD='secret'
export VIKUNJA_DATABASE_TYPE='postgres'
export VIKUNJA_DATABASE_USER='vikunja'
export VIKUNJA_SERVICE_ENABLEREGISTRATION='true'
export VIKUNJA_SERVICE_FRONTENDURL='https://vikunja.domain.com/'
export VIKUNJA_SERVICE_JWTSECRET='super secret'
export VIKUNJA_SERVICE_ROOTPATH='/app/vikunja/'

Vikunja Frontend Version

latest

Vikunja API Version

latest

Browser and version

No response

Can you reproduce the bug on the Vikunja demo site?

No

Screenshots

No response

Originally created by @soderluk on GitHub (Aug 23, 2023). Original GitHub issue: https://github.com/go-vikunja/vikunja/issues/81 ### Description I'm using docker-compose to run vikunja, and everything works nicely, except that when I set the `VIKUNJA_SERVICE_ENABLEREGISTRATION=false` or `VIKUNJA_SERVICE_ENABLEREGISTRATION=0` it's still `VIKUNJA_SERVICE_ENABLEREGISTRATION='true'` in the container. My docker-compose.yml file: ``` version: '3' services: database: image: postgres:14-alpine@sha256:28407a9961e76f2d285dc6991e8e48893503cc3836a4755bbc2d40bcc272a441 container_name: vikunja_postgres env_file: - .env volumes: - vikunja_postgres:/var/lib/postgresql/data restart: always api: image: vikunja/api container_name: vikunja_api env_file: - .env volumes: - vikunja_api:/app/vikunja/files ports: - 3456:3456 depends_on: - database restart: always frontend: image: vikunja/frontend container_name: vikunja_frontend ports: - 8081:80 restart: always volumes: vikunja_postgres: vikunja_api: ``` Here's the .env file: ``` POSTGRES_PASSWORD="secret" POSTGRES_USER="vikunja" POSTGRES_DB="vikunja" VIKUNJA_DATABASE_HOST="vikunja_postgres" VIKUNJA_DATABASE_TYPE="postgres" VIKUNJA_DATABASE_PASSWORD="${POSTGRES_PASSWORD}" VIKUNJA_DATABASE_USER="${POSTGRES_USER}" VIKUNJA_DATABASE_DATABASE="${POSTGRES_DB}" VIKUNJA_SERVICE_JWTSECRET="super secret" VIKUNJA_SERVICE_FRONTENDURL="https://vikunja.domain.com/" VIKUNJA_SERVICE_ENABLEREGISTRATION=false ``` Everything else is set correctly, but the `VIKUNJA_SERVICE_ENABLEREGISTRATION`. Verified by `docker exec -it vikunja_api sh` and running `/app/vikunja # export`: ``` export HOME='/root' export HOSTNAME='26d323421cb1' export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' export PGID='1000' export POSTGRES_DB='vikunja' export POSTGRES_PASSWORD='secret' export POSTGRES_USER='vikunja' export PUID='1000' export PWD='/app/vikunja' export SHLVL='1' export TERM='xterm' export VIKUNJA_DATABASE_DATABASE='vikunja' export VIKUNJA_DATABASE_HOST='vikunja_postgres' export VIKUNJA_DATABASE_PASSWORD='secret' export VIKUNJA_DATABASE_TYPE='postgres' export VIKUNJA_DATABASE_USER='vikunja' export VIKUNJA_SERVICE_ENABLEREGISTRATION='true' export VIKUNJA_SERVICE_FRONTENDURL='https://vikunja.domain.com/' export VIKUNJA_SERVICE_JWTSECRET='super secret' export VIKUNJA_SERVICE_ROOTPATH='/app/vikunja/' ``` ### Vikunja Frontend Version latest ### Vikunja API Version latest ### Browser and version _No response_ ### Can you reproduce the bug on the Vikunja demo site? No ### Screenshots _No response_
Author
Owner

@kolaente commented on GitHub (Aug 23, 2023):

Seems to be an issue with docker compose. This works fine:

$ docker run -it -e VIKUNJA_SERVICE_ENABLEREGISTRATION=false --entrypoint sh vikunja/api

/app/vikunja # export
export HOME='/root'
export HOSTNAME='ec081e05c04f'
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
export PGID='1000'
export PUID='1000'
export PWD='/app/vikunja'
export SHLVL='1'
export TERM='xterm'
export VIKUNJA_SERVICE_ENABLEREGISTRATION='false'
export VIKUNJA_SERVICE_ROOTPATH='/app/vikunja/'
<!-- gh-comment-id:1689873466 --> @kolaente commented on GitHub (Aug 23, 2023): Seems to be an issue with docker compose. This works fine: ``` $ docker run -it -e VIKUNJA_SERVICE_ENABLEREGISTRATION=false --entrypoint sh vikunja/api /app/vikunja # export export HOME='/root' export HOSTNAME='ec081e05c04f' export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' export PGID='1000' export PUID='1000' export PWD='/app/vikunja' export SHLVL='1' export TERM='xterm' export VIKUNJA_SERVICE_ENABLEREGISTRATION='false' export VIKUNJA_SERVICE_ROOTPATH='/app/vikunja/' ```
Author
Owner

@kolaente commented on GitHub (Aug 23, 2023):

Does it work if you add the env variable directly to the compose config?

<!-- gh-comment-id:1689874201 --> @kolaente commented on GitHub (Aug 23, 2023): Does it work if you add the env variable directly to the compose config?
Author
Owner

@soderluk commented on GitHub (Aug 23, 2023):

Nope, doesn't work. Tested with:

environment:
  VIKUNJA_SERVICE_ENABLEREGISTRATION: "false" # and 0

and

environment:
  - VIKUNJA_SERVICE_ENABLEREGISTRATION=false

None of the three methods I tested changes the environment variable to false in the container.

Edit:
After some googling around, starting docker-composer prepended with VIKUNJA_SERVICE_ENABLEREGISTRATION=false docker-compose up -d works. I'm out of ideas as to why it wouldn't pass in it from the docker-compose file?

<!-- gh-comment-id:1689924148 --> @soderluk commented on GitHub (Aug 23, 2023): Nope, doesn't work. Tested with: ``` environment: VIKUNJA_SERVICE_ENABLEREGISTRATION: "false" # and 0 ``` and ``` environment: - VIKUNJA_SERVICE_ENABLEREGISTRATION=false ``` None of the three methods I tested changes the environment variable to false in the container. Edit: After some googling around, starting docker-composer prepended with `VIKUNJA_SERVICE_ENABLEREGISTRATION=false docker-compose up -d` works. I'm out of ideas as to why it wouldn't pass in it from the docker-compose file?
Author
Owner

@soderluk commented on GitHub (Aug 23, 2023):

OK, more googling, and finally came to a conclusion:

env_file:
  - .env
environment:
  VIKUNJA_SERVICE_ENABLEREGISTRATION: ${VIKUNJA_SERVICE_ENABLEREGISTRATION}

If someone else has this same issue, you need to provide the environment variables to use separately. I had misunderstood the env_file functionality in a docker-compose file. The answer from SO here explains: https://stackoverflow.com/a/72368718

<!-- gh-comment-id:1689959986 --> @soderluk commented on GitHub (Aug 23, 2023): OK, more googling, and finally came to a conclusion: ``` env_file: - .env environment: VIKUNJA_SERVICE_ENABLEREGISTRATION: ${VIKUNJA_SERVICE_ENABLEREGISTRATION} ``` If someone else has this same issue, you need to provide the environment variables to use separately. I had misunderstood the `env_file` functionality in a docker-compose file. The answer from SO here explains: https://stackoverflow.com/a/72368718
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#5945