NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.1k stars 13.41k forks source link

services.gitea cannot amend top-level ini values #276577

Closed sielicki closed 7 months ago

sielicki commented 8 months ago

Describe the bug

Settings for authentication based registration (https://docs.gitea.com/next/usage/authentication#reverse-proxy) are not accessible in the service. services.gitea.extraConfig exists, but is amended to the bottom of the ini file, and due to the way that ini files work (because there is no way to end a section) there is no way to add these lines in a way that makes them work.

Note that

      service = {
        DISABLE_REGISTRATION = true;
        ENABLE_REVERSE_PROXY_AUTHENTICATION = true;
        ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = true;
        ENABLE_REVERSE_PROXY_FULL_NAME = true;
        ENABLE_REVERSE_PROXY_EMAIL = true;
      };

Does work to enable the feature, but the header keys and how they are understood by gitea are not.

Steps To Reproduce

N/A

Expected behavior

Provide an escape hatch.

Notify maintainers

@srhb @Ma27 @pyrox0

Add a :+1: reaction to issues you find important.

Ma27 commented 8 months ago

Does work to enable the feature, but the header keys and how they are understood by gitea are not.

I'm sorry, but I don't understand. The entire section in the upstream documentation reads to me as if all of these keys need to be placed below [service]. Is that wrong?

Please show me the final config you'd expect to get.

sielicki commented 8 months ago

The entire section in the upstream documentation reads to me as if all of these keys need to be placed below [service]. Is that wrong?

They need to be placed in app.ini but not under service.

https://github.com/go-gitea/gitea/commit/64c3d55de7f3a46b4b73a119f11b2d337ca4eaa6

versus

eg: under the comment block for "General settings" here

Ma27 commented 8 months ago

FWIW the docs should be updated accordingly on their side, but OK, got it. Then we can focus on the fix PR (left a comment already) :)

sielicki commented 8 months ago

upon reflection of the link I just found, it looks like these actually belong under security:

https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini#L446-L449

they really should update their docs.