Docker unable to configure using all environment variables

Gitea 1.4.1 (Dockerized)

I’m using the Docker image to setup Gitea, however I’ve found that I’m limited to setting only a subset of the entire configuration options.

The “Install with Docker” page mentions…

You can configure some of Gitea’s settings via environment variables:

But why only some, and not all?

I need to be able to set DISABLE_REGISTRATION to true, but it has no effect. What can I do?

docker-compose.yml

version: '3'
services:
  web:
    image: gitea/gitea:1.4.1
    restart: always
    volumes:
      - web_data:/data
    ports:
      - "3000:3000"
      - "22:22"
    environment:
      APP_NAME: myapp
      RUN_MODE: prod
      DISABLE_REGISTRATION: "true"
      SECRET_KEY: password123
      INSTALL_LOCK: "true"

volumes:
  web_data:

Note:

This looks like the template that is used for app.ini.

Wish I could use all the options used in app.ini.sample.

Haven’t tried it myself, but I think it should be possible to create the app.ini beforehand and mount that on docker run to the correct folder in the container.

I create the app.ini beforehand, however if you want to use entirely environment variables then the following is a link to where the environment variable substitution happens https://github.com/go-gitea/gitea/blob/master/docker/etc/s6/gitea/setup#L25-L39 so rather than rolling your own docker image, you could contribute back to the project.

The reason “not all” options are environment variables, is because there is a TON of options, and they usually just get added as a user needs them.

If you do create a PR feel free to cc me (same username on github), and I’d be able to do a maintainer review for you.

Thanks @daviian & @techknowlogick , didn’t realise I could just map my own app.ini file in.

Here’s the docker-compose.yml section…

volumes:
  - web_data:/data
  - ./gitea/app.ini:/data/gitea/conf/app.ini

Hi @nick,

There was a recent commit that added DISABLE_REGISTRATION as an environment variable for docker. This will get released in version 1.5.0, however is available with the docker tag lastest.

Thanks,

@techknowlogick

Hey

I am having a similar issue, however Gitea seems to break when i try to map my own app.ini file, even when giving the Gitea user inside the container write-access.

I suspect this is due to missing secrets (like SECRET_KEY). However, I can’t keep those in my app.ini file, since I want my app.ini file in a public repo.

Does anybody have an example of a mapped app.ini in a public repo? Would be greatly appreciated :slight_smile:

Otherwise, if somebody is willing to help me understand how secrets are generated (or link to that place in the source code), then i can replicate that at deploy-time.